From 6f8be2e376c8bb30c6a0b698405fb298d8be0be5 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sat, 2 May 2020 02:02:18 +0200 Subject: [PATCH] Serializable TdApi --- src/main/java/it/ernytech/tdlib/TdApi.java | 42254 ++++++++++++++++--- 1 file changed, 37225 insertions(+), 5029 deletions(-) diff --git a/src/main/java/it/ernytech/tdlib/TdApi.java b/src/main/java/it/ernytech/tdlib/TdApi.java index 8580234..5445258 100644 --- a/src/main/java/it/ernytech/tdlib/TdApi.java +++ b/src/main/java/it/ernytech/tdlib/TdApi.java @@ -1,32 +1,2519 @@ package it.ernytech.tdlib; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.DataInputStream; +import java.nio.charset.StandardCharsets; +import java.lang.IllegalStateException; +import java.io.IOException; + + public class TdApi { public abstract static class Object { public native String toString(); public abstract int getConstructor(); + + public byte[] serialize() throws IOException { + try(var baos = new ByteArrayOutputStream()) { + try(var out = new DataOutputStream(baos)) { + serialize(out); + return baos.toByteArray(); + } + } + } + + public abstract void serialize(DataOutputStream out) throws IOException; } public abstract static class Function extends Object { public native String toString(); } + public static class Deserializer { + public static Object deserialize(DataInputStream input) throws IOException { + switch(input.readInt()) { + case AccountTtl.CONSTRUCTOR: + return new AccountTtl(input); + case Address.CONSTRUCTOR: + return new Address(input); + case Animation.CONSTRUCTOR: + return new Animation(input); + case Animations.CONSTRUCTOR: + return new Animations(input); + case Audio.CONSTRUCTOR: + return new Audio(input); + case AuthenticationCodeInfo.CONSTRUCTOR: + return new AuthenticationCodeInfo(input); + case AuthenticationCodeTypeTelegramMessage.CONSTRUCTOR: + return new AuthenticationCodeTypeTelegramMessage(input); + case AuthenticationCodeTypeSms.CONSTRUCTOR: + return new AuthenticationCodeTypeSms(input); + case AuthenticationCodeTypeCall.CONSTRUCTOR: + return new AuthenticationCodeTypeCall(input); + case AuthenticationCodeTypeFlashCall.CONSTRUCTOR: + return new AuthenticationCodeTypeFlashCall(input); + case AuthorizationStateWaitTdlibParameters.CONSTRUCTOR: + return new AuthorizationStateWaitTdlibParameters(input); + case AuthorizationStateWaitEncryptionKey.CONSTRUCTOR: + return new AuthorizationStateWaitEncryptionKey(input); + case AuthorizationStateWaitPhoneNumber.CONSTRUCTOR: + return new AuthorizationStateWaitPhoneNumber(input); + case AuthorizationStateWaitCode.CONSTRUCTOR: + return new AuthorizationStateWaitCode(input); + case AuthorizationStateWaitOtherDeviceConfirmation.CONSTRUCTOR: + return new AuthorizationStateWaitOtherDeviceConfirmation(input); + case AuthorizationStateWaitRegistration.CONSTRUCTOR: + return new AuthorizationStateWaitRegistration(input); + case AuthorizationStateWaitPassword.CONSTRUCTOR: + return new AuthorizationStateWaitPassword(input); + case AuthorizationStateReady.CONSTRUCTOR: + return new AuthorizationStateReady(input); + case AuthorizationStateLoggingOut.CONSTRUCTOR: + return new AuthorizationStateLoggingOut(input); + case AuthorizationStateClosing.CONSTRUCTOR: + return new AuthorizationStateClosing(input); + case AuthorizationStateClosed.CONSTRUCTOR: + return new AuthorizationStateClosed(input); + case AutoDownloadSettings.CONSTRUCTOR: + return new AutoDownloadSettings(input); + case AutoDownloadSettingsPresets.CONSTRUCTOR: + return new AutoDownloadSettingsPresets(input); + case Background.CONSTRUCTOR: + return new Background(input); + case BackgroundFillSolid.CONSTRUCTOR: + return new BackgroundFillSolid(input); + case BackgroundFillGradient.CONSTRUCTOR: + return new BackgroundFillGradient(input); + case BackgroundTypeWallpaper.CONSTRUCTOR: + return new BackgroundTypeWallpaper(input); + case BackgroundTypePattern.CONSTRUCTOR: + return new BackgroundTypePattern(input); + case BackgroundTypeFill.CONSTRUCTOR: + return new BackgroundTypeFill(input); + case Backgrounds.CONSTRUCTOR: + return new Backgrounds(input); + case BankCardActionOpenUrl.CONSTRUCTOR: + return new BankCardActionOpenUrl(input); + case BankCardInfo.CONSTRUCTOR: + return new BankCardInfo(input); + case BasicGroup.CONSTRUCTOR: + return new BasicGroup(input); + case BasicGroupFullInfo.CONSTRUCTOR: + return new BasicGroupFullInfo(input); + case BotCommand.CONSTRUCTOR: + return new BotCommand(input); + case BotInfo.CONSTRUCTOR: + return new BotInfo(input); + case Call.CONSTRUCTOR: + return new Call(input); + case CallConnection.CONSTRUCTOR: + return new CallConnection(input); + case CallDiscardReasonEmpty.CONSTRUCTOR: + return new CallDiscardReasonEmpty(input); + case CallDiscardReasonMissed.CONSTRUCTOR: + return new CallDiscardReasonMissed(input); + case CallDiscardReasonDeclined.CONSTRUCTOR: + return new CallDiscardReasonDeclined(input); + case CallDiscardReasonDisconnected.CONSTRUCTOR: + return new CallDiscardReasonDisconnected(input); + case CallDiscardReasonHungUp.CONSTRUCTOR: + return new CallDiscardReasonHungUp(input); + case CallId.CONSTRUCTOR: + return new CallId(input); + case CallProblemEcho.CONSTRUCTOR: + return new CallProblemEcho(input); + case CallProblemNoise.CONSTRUCTOR: + return new CallProblemNoise(input); + case CallProblemInterruptions.CONSTRUCTOR: + return new CallProblemInterruptions(input); + case CallProblemDistortedSpeech.CONSTRUCTOR: + return new CallProblemDistortedSpeech(input); + case CallProblemSilentLocal.CONSTRUCTOR: + return new CallProblemSilentLocal(input); + case CallProblemSilentRemote.CONSTRUCTOR: + return new CallProblemSilentRemote(input); + case CallProblemDropped.CONSTRUCTOR: + return new CallProblemDropped(input); + case CallProtocol.CONSTRUCTOR: + return new CallProtocol(input); + case CallStatePending.CONSTRUCTOR: + return new CallStatePending(input); + case CallStateExchangingKeys.CONSTRUCTOR: + return new CallStateExchangingKeys(input); + case CallStateReady.CONSTRUCTOR: + return new CallStateReady(input); + case CallStateHangingUp.CONSTRUCTOR: + return new CallStateHangingUp(input); + case CallStateDiscarded.CONSTRUCTOR: + return new CallStateDiscarded(input); + case CallStateError.CONSTRUCTOR: + return new CallStateError(input); + case CallbackQueryAnswer.CONSTRUCTOR: + return new CallbackQueryAnswer(input); + case CallbackQueryPayloadData.CONSTRUCTOR: + return new CallbackQueryPayloadData(input); + case CallbackQueryPayloadGame.CONSTRUCTOR: + return new CallbackQueryPayloadGame(input); + case CanTransferOwnershipResultOk.CONSTRUCTOR: + return new CanTransferOwnershipResultOk(input); + case CanTransferOwnershipResultPasswordNeeded.CONSTRUCTOR: + return new CanTransferOwnershipResultPasswordNeeded(input); + case CanTransferOwnershipResultPasswordTooFresh.CONSTRUCTOR: + return new CanTransferOwnershipResultPasswordTooFresh(input); + case CanTransferOwnershipResultSessionTooFresh.CONSTRUCTOR: + return new CanTransferOwnershipResultSessionTooFresh(input); + case Chat.CONSTRUCTOR: + return new Chat(input); + case ChatActionTyping.CONSTRUCTOR: + return new ChatActionTyping(input); + case ChatActionRecordingVideo.CONSTRUCTOR: + return new ChatActionRecordingVideo(input); + case ChatActionUploadingVideo.CONSTRUCTOR: + return new ChatActionUploadingVideo(input); + case ChatActionRecordingVoiceNote.CONSTRUCTOR: + return new ChatActionRecordingVoiceNote(input); + case ChatActionUploadingVoiceNote.CONSTRUCTOR: + return new ChatActionUploadingVoiceNote(input); + case ChatActionUploadingPhoto.CONSTRUCTOR: + return new ChatActionUploadingPhoto(input); + case ChatActionUploadingDocument.CONSTRUCTOR: + return new ChatActionUploadingDocument(input); + case ChatActionChoosingLocation.CONSTRUCTOR: + return new ChatActionChoosingLocation(input); + case ChatActionChoosingContact.CONSTRUCTOR: + return new ChatActionChoosingContact(input); + case ChatActionStartPlayingGame.CONSTRUCTOR: + return new ChatActionStartPlayingGame(input); + case ChatActionRecordingVideoNote.CONSTRUCTOR: + return new ChatActionRecordingVideoNote(input); + case ChatActionUploadingVideoNote.CONSTRUCTOR: + return new ChatActionUploadingVideoNote(input); + case ChatActionCancel.CONSTRUCTOR: + return new ChatActionCancel(input); + case ChatActionBarReportSpam.CONSTRUCTOR: + return new ChatActionBarReportSpam(input); + case ChatActionBarReportUnrelatedLocation.CONSTRUCTOR: + return new ChatActionBarReportUnrelatedLocation(input); + case ChatActionBarReportAddBlock.CONSTRUCTOR: + return new ChatActionBarReportAddBlock(input); + case ChatActionBarAddContact.CONSTRUCTOR: + return new ChatActionBarAddContact(input); + case ChatActionBarSharePhoneNumber.CONSTRUCTOR: + return new ChatActionBarSharePhoneNumber(input); + case ChatAdministrator.CONSTRUCTOR: + return new ChatAdministrator(input); + case ChatAdministrators.CONSTRUCTOR: + return new ChatAdministrators(input); + case ChatEvent.CONSTRUCTOR: + return new ChatEvent(input); + case ChatEventMessageEdited.CONSTRUCTOR: + return new ChatEventMessageEdited(input); + case ChatEventMessageDeleted.CONSTRUCTOR: + return new ChatEventMessageDeleted(input); + case ChatEventPollStopped.CONSTRUCTOR: + return new ChatEventPollStopped(input); + case ChatEventMessagePinned.CONSTRUCTOR: + return new ChatEventMessagePinned(input); + case ChatEventMessageUnpinned.CONSTRUCTOR: + return new ChatEventMessageUnpinned(input); + case ChatEventMemberJoined.CONSTRUCTOR: + return new ChatEventMemberJoined(input); + case ChatEventMemberLeft.CONSTRUCTOR: + return new ChatEventMemberLeft(input); + case ChatEventMemberInvited.CONSTRUCTOR: + return new ChatEventMemberInvited(input); + case ChatEventMemberPromoted.CONSTRUCTOR: + return new ChatEventMemberPromoted(input); + case ChatEventMemberRestricted.CONSTRUCTOR: + return new ChatEventMemberRestricted(input); + case ChatEventTitleChanged.CONSTRUCTOR: + return new ChatEventTitleChanged(input); + case ChatEventPermissionsChanged.CONSTRUCTOR: + return new ChatEventPermissionsChanged(input); + case ChatEventDescriptionChanged.CONSTRUCTOR: + return new ChatEventDescriptionChanged(input); + case ChatEventUsernameChanged.CONSTRUCTOR: + return new ChatEventUsernameChanged(input); + case ChatEventPhotoChanged.CONSTRUCTOR: + return new ChatEventPhotoChanged(input); + case ChatEventInvitesToggled.CONSTRUCTOR: + return new ChatEventInvitesToggled(input); + case ChatEventLinkedChatChanged.CONSTRUCTOR: + return new ChatEventLinkedChatChanged(input); + case ChatEventSlowModeDelayChanged.CONSTRUCTOR: + return new ChatEventSlowModeDelayChanged(input); + case ChatEventSignMessagesToggled.CONSTRUCTOR: + return new ChatEventSignMessagesToggled(input); + case ChatEventStickerSetChanged.CONSTRUCTOR: + return new ChatEventStickerSetChanged(input); + case ChatEventLocationChanged.CONSTRUCTOR: + return new ChatEventLocationChanged(input); + case ChatEventIsAllHistoryAvailableToggled.CONSTRUCTOR: + return new ChatEventIsAllHistoryAvailableToggled(input); + case ChatEventLogFilters.CONSTRUCTOR: + return new ChatEventLogFilters(input); + case ChatEvents.CONSTRUCTOR: + return new ChatEvents(input); + case ChatInviteLink.CONSTRUCTOR: + return new ChatInviteLink(input); + case ChatInviteLinkInfo.CONSTRUCTOR: + return new ChatInviteLinkInfo(input); + case ChatListMain.CONSTRUCTOR: + return new ChatListMain(input); + case ChatListArchive.CONSTRUCTOR: + return new ChatListArchive(input); + case ChatLocation.CONSTRUCTOR: + return new ChatLocation(input); + case ChatMember.CONSTRUCTOR: + return new ChatMember(input); + case ChatMemberStatusCreator.CONSTRUCTOR: + return new ChatMemberStatusCreator(input); + case ChatMemberStatusAdministrator.CONSTRUCTOR: + return new ChatMemberStatusAdministrator(input); + case ChatMemberStatusMember.CONSTRUCTOR: + return new ChatMemberStatusMember(input); + case ChatMemberStatusRestricted.CONSTRUCTOR: + return new ChatMemberStatusRestricted(input); + case ChatMemberStatusLeft.CONSTRUCTOR: + return new ChatMemberStatusLeft(input); + case ChatMemberStatusBanned.CONSTRUCTOR: + return new ChatMemberStatusBanned(input); + case ChatMembers.CONSTRUCTOR: + return new ChatMembers(input); + case ChatMembersFilterContacts.CONSTRUCTOR: + return new ChatMembersFilterContacts(input); + case ChatMembersFilterAdministrators.CONSTRUCTOR: + return new ChatMembersFilterAdministrators(input); + case ChatMembersFilterMembers.CONSTRUCTOR: + return new ChatMembersFilterMembers(input); + case ChatMembersFilterRestricted.CONSTRUCTOR: + return new ChatMembersFilterRestricted(input); + case ChatMembersFilterBanned.CONSTRUCTOR: + return new ChatMembersFilterBanned(input); + case ChatMembersFilterBots.CONSTRUCTOR: + return new ChatMembersFilterBots(input); + case ChatNearby.CONSTRUCTOR: + return new ChatNearby(input); + case ChatNotificationSettings.CONSTRUCTOR: + return new ChatNotificationSettings(input); + case ChatPermissions.CONSTRUCTOR: + return new ChatPermissions(input); + case ChatPhoto.CONSTRUCTOR: + return new ChatPhoto(input); + case ChatReportReasonSpam.CONSTRUCTOR: + return new ChatReportReasonSpam(input); + case ChatReportReasonViolence.CONSTRUCTOR: + return new ChatReportReasonViolence(input); + case ChatReportReasonPornography.CONSTRUCTOR: + return new ChatReportReasonPornography(input); + case ChatReportReasonChildAbuse.CONSTRUCTOR: + return new ChatReportReasonChildAbuse(input); + case ChatReportReasonCopyright.CONSTRUCTOR: + return new ChatReportReasonCopyright(input); + case ChatReportReasonUnrelatedLocation.CONSTRUCTOR: + return new ChatReportReasonUnrelatedLocation(input); + case ChatReportReasonCustom.CONSTRUCTOR: + return new ChatReportReasonCustom(input); + case ChatStatistics.CONSTRUCTOR: + return new ChatStatistics(input); + case ChatStatisticsMessageInteractionCounters.CONSTRUCTOR: + return new ChatStatisticsMessageInteractionCounters(input); + case ChatTypePrivate.CONSTRUCTOR: + return new ChatTypePrivate(input); + case ChatTypeBasicGroup.CONSTRUCTOR: + return new ChatTypeBasicGroup(input); + case ChatTypeSupergroup.CONSTRUCTOR: + return new ChatTypeSupergroup(input); + case ChatTypeSecret.CONSTRUCTOR: + return new ChatTypeSecret(input); + case Chats.CONSTRUCTOR: + return new Chats(input); + case ChatsNearby.CONSTRUCTOR: + return new ChatsNearby(input); + case CheckChatUsernameResultOk.CONSTRUCTOR: + return new CheckChatUsernameResultOk(input); + case CheckChatUsernameResultUsernameInvalid.CONSTRUCTOR: + return new CheckChatUsernameResultUsernameInvalid(input); + case CheckChatUsernameResultUsernameOccupied.CONSTRUCTOR: + return new CheckChatUsernameResultUsernameOccupied(input); + case CheckChatUsernameResultPublicChatsTooMuch.CONSTRUCTOR: + return new CheckChatUsernameResultPublicChatsTooMuch(input); + case CheckChatUsernameResultPublicGroupsUnavailable.CONSTRUCTOR: + return new CheckChatUsernameResultPublicGroupsUnavailable(input); + case ConnectedWebsite.CONSTRUCTOR: + return new ConnectedWebsite(input); + case ConnectedWebsites.CONSTRUCTOR: + return new ConnectedWebsites(input); + case ConnectionStateWaitingForNetwork.CONSTRUCTOR: + return new ConnectionStateWaitingForNetwork(input); + case ConnectionStateConnectingToProxy.CONSTRUCTOR: + return new ConnectionStateConnectingToProxy(input); + case ConnectionStateConnecting.CONSTRUCTOR: + return new ConnectionStateConnecting(input); + case ConnectionStateUpdating.CONSTRUCTOR: + return new ConnectionStateUpdating(input); + case ConnectionStateReady.CONSTRUCTOR: + return new ConnectionStateReady(input); + case Contact.CONSTRUCTOR: + return new Contact(input); + case Count.CONSTRUCTOR: + return new Count(input); + case CustomRequestResult.CONSTRUCTOR: + return new CustomRequestResult(input); + case DatabaseStatistics.CONSTRUCTOR: + return new DatabaseStatistics(input); + case Date.CONSTRUCTOR: + return new Date(input); + case DateRange.CONSTRUCTOR: + return new DateRange(input); + case DatedFile.CONSTRUCTOR: + return new DatedFile(input); + case DeepLinkInfo.CONSTRUCTOR: + return new DeepLinkInfo(input); + case DeviceTokenFirebaseCloudMessaging.CONSTRUCTOR: + return new DeviceTokenFirebaseCloudMessaging(input); + case DeviceTokenApplePush.CONSTRUCTOR: + return new DeviceTokenApplePush(input); + case DeviceTokenApplePushVoIP.CONSTRUCTOR: + return new DeviceTokenApplePushVoIP(input); + case DeviceTokenWindowsPush.CONSTRUCTOR: + return new DeviceTokenWindowsPush(input); + case DeviceTokenMicrosoftPush.CONSTRUCTOR: + return new DeviceTokenMicrosoftPush(input); + case DeviceTokenMicrosoftPushVoIP.CONSTRUCTOR: + return new DeviceTokenMicrosoftPushVoIP(input); + case DeviceTokenWebPush.CONSTRUCTOR: + return new DeviceTokenWebPush(input); + case DeviceTokenSimplePush.CONSTRUCTOR: + return new DeviceTokenSimplePush(input); + case DeviceTokenUbuntuPush.CONSTRUCTOR: + return new DeviceTokenUbuntuPush(input); + case DeviceTokenBlackBerryPush.CONSTRUCTOR: + return new DeviceTokenBlackBerryPush(input); + case DeviceTokenTizenPush.CONSTRUCTOR: + return new DeviceTokenTizenPush(input); + case Document.CONSTRUCTOR: + return new Document(input); + case DraftMessage.CONSTRUCTOR: + return new DraftMessage(input); + case EmailAddressAuthenticationCodeInfo.CONSTRUCTOR: + return new EmailAddressAuthenticationCodeInfo(input); + case Emojis.CONSTRUCTOR: + return new Emojis(input); + case EncryptedCredentials.CONSTRUCTOR: + return new EncryptedCredentials(input); + case EncryptedPassportElement.CONSTRUCTOR: + return new EncryptedPassportElement(input); + case Error.CONSTRUCTOR: + return new Error(input); + case File.CONSTRUCTOR: + return new File(input); + case FilePart.CONSTRUCTOR: + return new FilePart(input); + case FileTypeNone.CONSTRUCTOR: + return new FileTypeNone(input); + case FileTypeAnimation.CONSTRUCTOR: + return new FileTypeAnimation(input); + case FileTypeAudio.CONSTRUCTOR: + return new FileTypeAudio(input); + case FileTypeDocument.CONSTRUCTOR: + return new FileTypeDocument(input); + case FileTypePhoto.CONSTRUCTOR: + return new FileTypePhoto(input); + case FileTypeProfilePhoto.CONSTRUCTOR: + return new FileTypeProfilePhoto(input); + case FileTypeSecret.CONSTRUCTOR: + return new FileTypeSecret(input); + case FileTypeSecretThumbnail.CONSTRUCTOR: + return new FileTypeSecretThumbnail(input); + case FileTypeSecure.CONSTRUCTOR: + return new FileTypeSecure(input); + case FileTypeSticker.CONSTRUCTOR: + return new FileTypeSticker(input); + case FileTypeThumbnail.CONSTRUCTOR: + return new FileTypeThumbnail(input); + case FileTypeUnknown.CONSTRUCTOR: + return new FileTypeUnknown(input); + case FileTypeVideo.CONSTRUCTOR: + return new FileTypeVideo(input); + case FileTypeVideoNote.CONSTRUCTOR: + return new FileTypeVideoNote(input); + case FileTypeVoiceNote.CONSTRUCTOR: + return new FileTypeVoiceNote(input); + case FileTypeWallpaper.CONSTRUCTOR: + return new FileTypeWallpaper(input); + case FormattedText.CONSTRUCTOR: + return new FormattedText(input); + case FoundMessages.CONSTRUCTOR: + return new FoundMessages(input); + case Game.CONSTRUCTOR: + return new Game(input); + case GameHighScore.CONSTRUCTOR: + return new GameHighScore(input); + case GameHighScores.CONSTRUCTOR: + return new GameHighScores(input); + case Hashtags.CONSTRUCTOR: + return new Hashtags(input); + case HttpUrl.CONSTRUCTOR: + return new HttpUrl(input); + case IdentityDocument.CONSTRUCTOR: + return new IdentityDocument(input); + case ImportedContacts.CONSTRUCTOR: + return new ImportedContacts(input); + case InlineKeyboardButton.CONSTRUCTOR: + return new InlineKeyboardButton(input); + case InlineKeyboardButtonTypeUrl.CONSTRUCTOR: + return new InlineKeyboardButtonTypeUrl(input); + case InlineKeyboardButtonTypeLoginUrl.CONSTRUCTOR: + return new InlineKeyboardButtonTypeLoginUrl(input); + case InlineKeyboardButtonTypeCallback.CONSTRUCTOR: + return new InlineKeyboardButtonTypeCallback(input); + case InlineKeyboardButtonTypeCallbackGame.CONSTRUCTOR: + return new InlineKeyboardButtonTypeCallbackGame(input); + case InlineKeyboardButtonTypeSwitchInline.CONSTRUCTOR: + return new InlineKeyboardButtonTypeSwitchInline(input); + case InlineKeyboardButtonTypeBuy.CONSTRUCTOR: + return new InlineKeyboardButtonTypeBuy(input); + case InlineQueryResultArticle.CONSTRUCTOR: + return new InlineQueryResultArticle(input); + case InlineQueryResultContact.CONSTRUCTOR: + return new InlineQueryResultContact(input); + case InlineQueryResultLocation.CONSTRUCTOR: + return new InlineQueryResultLocation(input); + case InlineQueryResultVenue.CONSTRUCTOR: + return new InlineQueryResultVenue(input); + case InlineQueryResultGame.CONSTRUCTOR: + return new InlineQueryResultGame(input); + case InlineQueryResultAnimation.CONSTRUCTOR: + return new InlineQueryResultAnimation(input); + case InlineQueryResultAudio.CONSTRUCTOR: + return new InlineQueryResultAudio(input); + case InlineQueryResultDocument.CONSTRUCTOR: + return new InlineQueryResultDocument(input); + case InlineQueryResultPhoto.CONSTRUCTOR: + return new InlineQueryResultPhoto(input); + case InlineQueryResultSticker.CONSTRUCTOR: + return new InlineQueryResultSticker(input); + case InlineQueryResultVideo.CONSTRUCTOR: + return new InlineQueryResultVideo(input); + case InlineQueryResultVoiceNote.CONSTRUCTOR: + return new InlineQueryResultVoiceNote(input); + case InlineQueryResults.CONSTRUCTOR: + return new InlineQueryResults(input); + case InputBackgroundLocal.CONSTRUCTOR: + return new InputBackgroundLocal(input); + case InputBackgroundRemote.CONSTRUCTOR: + return new InputBackgroundRemote(input); + case InputCredentialsSaved.CONSTRUCTOR: + return new InputCredentialsSaved(input); + case InputCredentialsNew.CONSTRUCTOR: + return new InputCredentialsNew(input); + case InputCredentialsAndroidPay.CONSTRUCTOR: + return new InputCredentialsAndroidPay(input); + case InputCredentialsApplePay.CONSTRUCTOR: + return new InputCredentialsApplePay(input); + case InputFileId.CONSTRUCTOR: + return new InputFileId(input); + case InputFileRemote.CONSTRUCTOR: + return new InputFileRemote(input); + case InputFileLocal.CONSTRUCTOR: + return new InputFileLocal(input); + case InputFileGenerated.CONSTRUCTOR: + return new InputFileGenerated(input); + case InputIdentityDocument.CONSTRUCTOR: + return new InputIdentityDocument(input); + case InputInlineQueryResultAnimatedGif.CONSTRUCTOR: + return new InputInlineQueryResultAnimatedGif(input); + case InputInlineQueryResultAnimatedMpeg4.CONSTRUCTOR: + return new InputInlineQueryResultAnimatedMpeg4(input); + case InputInlineQueryResultArticle.CONSTRUCTOR: + return new InputInlineQueryResultArticle(input); + case InputInlineQueryResultAudio.CONSTRUCTOR: + return new InputInlineQueryResultAudio(input); + case InputInlineQueryResultContact.CONSTRUCTOR: + return new InputInlineQueryResultContact(input); + case InputInlineQueryResultDocument.CONSTRUCTOR: + return new InputInlineQueryResultDocument(input); + case InputInlineQueryResultGame.CONSTRUCTOR: + return new InputInlineQueryResultGame(input); + case InputInlineQueryResultLocation.CONSTRUCTOR: + return new InputInlineQueryResultLocation(input); + case InputInlineQueryResultPhoto.CONSTRUCTOR: + return new InputInlineQueryResultPhoto(input); + case InputInlineQueryResultSticker.CONSTRUCTOR: + return new InputInlineQueryResultSticker(input); + case InputInlineQueryResultVenue.CONSTRUCTOR: + return new InputInlineQueryResultVenue(input); + case InputInlineQueryResultVideo.CONSTRUCTOR: + return new InputInlineQueryResultVideo(input); + case InputInlineQueryResultVoiceNote.CONSTRUCTOR: + return new InputInlineQueryResultVoiceNote(input); + case InputMessageText.CONSTRUCTOR: + return new InputMessageText(input); + case InputMessageAnimation.CONSTRUCTOR: + return new InputMessageAnimation(input); + case InputMessageAudio.CONSTRUCTOR: + return new InputMessageAudio(input); + case InputMessageDocument.CONSTRUCTOR: + return new InputMessageDocument(input); + case InputMessagePhoto.CONSTRUCTOR: + return new InputMessagePhoto(input); + case InputMessageSticker.CONSTRUCTOR: + return new InputMessageSticker(input); + case InputMessageVideo.CONSTRUCTOR: + return new InputMessageVideo(input); + case InputMessageVideoNote.CONSTRUCTOR: + return new InputMessageVideoNote(input); + case InputMessageVoiceNote.CONSTRUCTOR: + return new InputMessageVoiceNote(input); + case InputMessageLocation.CONSTRUCTOR: + return new InputMessageLocation(input); + case InputMessageVenue.CONSTRUCTOR: + return new InputMessageVenue(input); + case InputMessageContact.CONSTRUCTOR: + return new InputMessageContact(input); + case InputMessageDice.CONSTRUCTOR: + return new InputMessageDice(input); + case InputMessageGame.CONSTRUCTOR: + return new InputMessageGame(input); + case InputMessageInvoice.CONSTRUCTOR: + return new InputMessageInvoice(input); + case InputMessagePoll.CONSTRUCTOR: + return new InputMessagePoll(input); + case InputMessageForwarded.CONSTRUCTOR: + return new InputMessageForwarded(input); + case InputPassportElementPersonalDetails.CONSTRUCTOR: + return new InputPassportElementPersonalDetails(input); + case InputPassportElementPassport.CONSTRUCTOR: + return new InputPassportElementPassport(input); + case InputPassportElementDriverLicense.CONSTRUCTOR: + return new InputPassportElementDriverLicense(input); + case InputPassportElementIdentityCard.CONSTRUCTOR: + return new InputPassportElementIdentityCard(input); + case InputPassportElementInternalPassport.CONSTRUCTOR: + return new InputPassportElementInternalPassport(input); + case InputPassportElementAddress.CONSTRUCTOR: + return new InputPassportElementAddress(input); + case InputPassportElementUtilityBill.CONSTRUCTOR: + return new InputPassportElementUtilityBill(input); + case InputPassportElementBankStatement.CONSTRUCTOR: + return new InputPassportElementBankStatement(input); + case InputPassportElementRentalAgreement.CONSTRUCTOR: + return new InputPassportElementRentalAgreement(input); + case InputPassportElementPassportRegistration.CONSTRUCTOR: + return new InputPassportElementPassportRegistration(input); + case InputPassportElementTemporaryRegistration.CONSTRUCTOR: + return new InputPassportElementTemporaryRegistration(input); + case InputPassportElementPhoneNumber.CONSTRUCTOR: + return new InputPassportElementPhoneNumber(input); + case InputPassportElementEmailAddress.CONSTRUCTOR: + return new InputPassportElementEmailAddress(input); + case InputPassportElementError.CONSTRUCTOR: + return new InputPassportElementError(input); + case InputPassportElementErrorSourceUnspecified.CONSTRUCTOR: + return new InputPassportElementErrorSourceUnspecified(input); + case InputPassportElementErrorSourceDataField.CONSTRUCTOR: + return new InputPassportElementErrorSourceDataField(input); + case InputPassportElementErrorSourceFrontSide.CONSTRUCTOR: + return new InputPassportElementErrorSourceFrontSide(input); + case InputPassportElementErrorSourceReverseSide.CONSTRUCTOR: + return new InputPassportElementErrorSourceReverseSide(input); + case InputPassportElementErrorSourceSelfie.CONSTRUCTOR: + return new InputPassportElementErrorSourceSelfie(input); + case InputPassportElementErrorSourceTranslationFile.CONSTRUCTOR: + return new InputPassportElementErrorSourceTranslationFile(input); + case InputPassportElementErrorSourceTranslationFiles.CONSTRUCTOR: + return new InputPassportElementErrorSourceTranslationFiles(input); + case InputPassportElementErrorSourceFile.CONSTRUCTOR: + return new InputPassportElementErrorSourceFile(input); + case InputPassportElementErrorSourceFiles.CONSTRUCTOR: + return new InputPassportElementErrorSourceFiles(input); + case InputPersonalDocument.CONSTRUCTOR: + return new InputPersonalDocument(input); + case InputStickerStatic.CONSTRUCTOR: + return new InputStickerStatic(input); + case InputStickerAnimated.CONSTRUCTOR: + return new InputStickerAnimated(input); + case InputThumbnail.CONSTRUCTOR: + return new InputThumbnail(input); + case Invoice.CONSTRUCTOR: + return new Invoice(input); + case JsonObjectMember.CONSTRUCTOR: + return new JsonObjectMember(input); + case JsonValueNull.CONSTRUCTOR: + return new JsonValueNull(input); + case JsonValueBoolean.CONSTRUCTOR: + return new JsonValueBoolean(input); + case JsonValueNumber.CONSTRUCTOR: + return new JsonValueNumber(input); + case JsonValueString.CONSTRUCTOR: + return new JsonValueString(input); + case JsonValueArray.CONSTRUCTOR: + return new JsonValueArray(input); + case JsonValueObject.CONSTRUCTOR: + return new JsonValueObject(input); + case KeyboardButton.CONSTRUCTOR: + return new KeyboardButton(input); + case KeyboardButtonTypeText.CONSTRUCTOR: + return new KeyboardButtonTypeText(input); + case KeyboardButtonTypeRequestPhoneNumber.CONSTRUCTOR: + return new KeyboardButtonTypeRequestPhoneNumber(input); + case KeyboardButtonTypeRequestLocation.CONSTRUCTOR: + return new KeyboardButtonTypeRequestLocation(input); + case KeyboardButtonTypeRequestPoll.CONSTRUCTOR: + return new KeyboardButtonTypeRequestPoll(input); + case LabeledPricePart.CONSTRUCTOR: + return new LabeledPricePart(input); + case LanguagePackInfo.CONSTRUCTOR: + return new LanguagePackInfo(input); + case LanguagePackString.CONSTRUCTOR: + return new LanguagePackString(input); + case LanguagePackStringValueOrdinary.CONSTRUCTOR: + return new LanguagePackStringValueOrdinary(input); + case LanguagePackStringValuePluralized.CONSTRUCTOR: + return new LanguagePackStringValuePluralized(input); + case LanguagePackStringValueDeleted.CONSTRUCTOR: + return new LanguagePackStringValueDeleted(input); + case LanguagePackStrings.CONSTRUCTOR: + return new LanguagePackStrings(input); + case LocalFile.CONSTRUCTOR: + return new LocalFile(input); + case LocalizationTargetInfo.CONSTRUCTOR: + return new LocalizationTargetInfo(input); + case Location.CONSTRUCTOR: + return new Location(input); + case LogStreamDefault.CONSTRUCTOR: + return new LogStreamDefault(input); + case LogStreamFile.CONSTRUCTOR: + return new LogStreamFile(input); + case LogStreamEmpty.CONSTRUCTOR: + return new LogStreamEmpty(input); + case LogTags.CONSTRUCTOR: + return new LogTags(input); + case LogVerbosityLevel.CONSTRUCTOR: + return new LogVerbosityLevel(input); + case LoginUrlInfoOpen.CONSTRUCTOR: + return new LoginUrlInfoOpen(input); + case LoginUrlInfoRequestConfirmation.CONSTRUCTOR: + return new LoginUrlInfoRequestConfirmation(input); + case MaskPointForehead.CONSTRUCTOR: + return new MaskPointForehead(input); + case MaskPointEyes.CONSTRUCTOR: + return new MaskPointEyes(input); + case MaskPointMouth.CONSTRUCTOR: + return new MaskPointMouth(input); + case MaskPointChin.CONSTRUCTOR: + return new MaskPointChin(input); + case MaskPosition.CONSTRUCTOR: + return new MaskPosition(input); + case Message.CONSTRUCTOR: + return new Message(input); + case MessageText.CONSTRUCTOR: + return new MessageText(input); + case MessageAnimation.CONSTRUCTOR: + return new MessageAnimation(input); + case MessageAudio.CONSTRUCTOR: + return new MessageAudio(input); + case MessageDocument.CONSTRUCTOR: + return new MessageDocument(input); + case MessagePhoto.CONSTRUCTOR: + return new MessagePhoto(input); + case MessageExpiredPhoto.CONSTRUCTOR: + return new MessageExpiredPhoto(input); + case MessageSticker.CONSTRUCTOR: + return new MessageSticker(input); + case MessageVideo.CONSTRUCTOR: + return new MessageVideo(input); + case MessageExpiredVideo.CONSTRUCTOR: + return new MessageExpiredVideo(input); + case MessageVideoNote.CONSTRUCTOR: + return new MessageVideoNote(input); + case MessageVoiceNote.CONSTRUCTOR: + return new MessageVoiceNote(input); + case MessageLocation.CONSTRUCTOR: + return new MessageLocation(input); + case MessageVenue.CONSTRUCTOR: + return new MessageVenue(input); + case MessageContact.CONSTRUCTOR: + return new MessageContact(input); + case MessageDice.CONSTRUCTOR: + return new MessageDice(input); + case MessageGame.CONSTRUCTOR: + return new MessageGame(input); + case MessagePoll.CONSTRUCTOR: + return new MessagePoll(input); + case MessageInvoice.CONSTRUCTOR: + return new MessageInvoice(input); + case MessageCall.CONSTRUCTOR: + return new MessageCall(input); + case MessageBasicGroupChatCreate.CONSTRUCTOR: + return new MessageBasicGroupChatCreate(input); + case MessageSupergroupChatCreate.CONSTRUCTOR: + return new MessageSupergroupChatCreate(input); + case MessageChatChangeTitle.CONSTRUCTOR: + return new MessageChatChangeTitle(input); + case MessageChatChangePhoto.CONSTRUCTOR: + return new MessageChatChangePhoto(input); + case MessageChatDeletePhoto.CONSTRUCTOR: + return new MessageChatDeletePhoto(input); + case MessageChatAddMembers.CONSTRUCTOR: + return new MessageChatAddMembers(input); + case MessageChatJoinByLink.CONSTRUCTOR: + return new MessageChatJoinByLink(input); + case MessageChatDeleteMember.CONSTRUCTOR: + return new MessageChatDeleteMember(input); + case MessageChatUpgradeTo.CONSTRUCTOR: + return new MessageChatUpgradeTo(input); + case MessageChatUpgradeFrom.CONSTRUCTOR: + return new MessageChatUpgradeFrom(input); + case MessagePinMessage.CONSTRUCTOR: + return new MessagePinMessage(input); + case MessageScreenshotTaken.CONSTRUCTOR: + return new MessageScreenshotTaken(input); + case MessageChatSetTtl.CONSTRUCTOR: + return new MessageChatSetTtl(input); + case MessageCustomServiceAction.CONSTRUCTOR: + return new MessageCustomServiceAction(input); + case MessageGameScore.CONSTRUCTOR: + return new MessageGameScore(input); + case MessagePaymentSuccessful.CONSTRUCTOR: + return new MessagePaymentSuccessful(input); + case MessagePaymentSuccessfulBot.CONSTRUCTOR: + return new MessagePaymentSuccessfulBot(input); + case MessageContactRegistered.CONSTRUCTOR: + return new MessageContactRegistered(input); + case MessageWebsiteConnected.CONSTRUCTOR: + return new MessageWebsiteConnected(input); + case MessagePassportDataSent.CONSTRUCTOR: + return new MessagePassportDataSent(input); + case MessagePassportDataReceived.CONSTRUCTOR: + return new MessagePassportDataReceived(input); + case MessageUnsupported.CONSTRUCTOR: + return new MessageUnsupported(input); + case MessageForwardInfo.CONSTRUCTOR: + return new MessageForwardInfo(input); + case MessageForwardOriginUser.CONSTRUCTOR: + return new MessageForwardOriginUser(input); + case MessageForwardOriginHiddenUser.CONSTRUCTOR: + return new MessageForwardOriginHiddenUser(input); + case MessageForwardOriginChannel.CONSTRUCTOR: + return new MessageForwardOriginChannel(input); + case MessageLinkInfo.CONSTRUCTOR: + return new MessageLinkInfo(input); + case MessageSchedulingStateSendAtDate.CONSTRUCTOR: + return new MessageSchedulingStateSendAtDate(input); + case MessageSchedulingStateSendWhenOnline.CONSTRUCTOR: + return new MessageSchedulingStateSendWhenOnline(input); + case MessageSendingStatePending.CONSTRUCTOR: + return new MessageSendingStatePending(input); + case MessageSendingStateFailed.CONSTRUCTOR: + return new MessageSendingStateFailed(input); + case Messages.CONSTRUCTOR: + return new Messages(input); + case Minithumbnail.CONSTRUCTOR: + return new Minithumbnail(input); + case NetworkStatistics.CONSTRUCTOR: + return new NetworkStatistics(input); + case NetworkStatisticsEntryFile.CONSTRUCTOR: + return new NetworkStatisticsEntryFile(input); + case NetworkStatisticsEntryCall.CONSTRUCTOR: + return new NetworkStatisticsEntryCall(input); + case NetworkTypeNone.CONSTRUCTOR: + return new NetworkTypeNone(input); + case NetworkTypeMobile.CONSTRUCTOR: + return new NetworkTypeMobile(input); + case NetworkTypeMobileRoaming.CONSTRUCTOR: + return new NetworkTypeMobileRoaming(input); + case NetworkTypeWiFi.CONSTRUCTOR: + return new NetworkTypeWiFi(input); + case NetworkTypeOther.CONSTRUCTOR: + return new NetworkTypeOther(input); + case Notification.CONSTRUCTOR: + return new Notification(input); + case NotificationGroup.CONSTRUCTOR: + return new NotificationGroup(input); + case NotificationGroupTypeMessages.CONSTRUCTOR: + return new NotificationGroupTypeMessages(input); + case NotificationGroupTypeMentions.CONSTRUCTOR: + return new NotificationGroupTypeMentions(input); + case NotificationGroupTypeSecretChat.CONSTRUCTOR: + return new NotificationGroupTypeSecretChat(input); + case NotificationGroupTypeCalls.CONSTRUCTOR: + return new NotificationGroupTypeCalls(input); + case NotificationSettingsScopePrivateChats.CONSTRUCTOR: + return new NotificationSettingsScopePrivateChats(input); + case NotificationSettingsScopeGroupChats.CONSTRUCTOR: + return new NotificationSettingsScopeGroupChats(input); + case NotificationSettingsScopeChannelChats.CONSTRUCTOR: + return new NotificationSettingsScopeChannelChats(input); + case NotificationTypeNewMessage.CONSTRUCTOR: + return new NotificationTypeNewMessage(input); + case NotificationTypeNewSecretChat.CONSTRUCTOR: + return new NotificationTypeNewSecretChat(input); + case NotificationTypeNewCall.CONSTRUCTOR: + return new NotificationTypeNewCall(input); + case NotificationTypeNewPushMessage.CONSTRUCTOR: + return new NotificationTypeNewPushMessage(input); + case Ok.CONSTRUCTOR: + return new Ok(input); + case OptionValueBoolean.CONSTRUCTOR: + return new OptionValueBoolean(input); + case OptionValueEmpty.CONSTRUCTOR: + return new OptionValueEmpty(input); + case OptionValueInteger.CONSTRUCTOR: + return new OptionValueInteger(input); + case OptionValueString.CONSTRUCTOR: + return new OptionValueString(input); + case OrderInfo.CONSTRUCTOR: + return new OrderInfo(input); + case PageBlockTitle.CONSTRUCTOR: + return new PageBlockTitle(input); + case PageBlockSubtitle.CONSTRUCTOR: + return new PageBlockSubtitle(input); + case PageBlockAuthorDate.CONSTRUCTOR: + return new PageBlockAuthorDate(input); + case PageBlockHeader.CONSTRUCTOR: + return new PageBlockHeader(input); + case PageBlockSubheader.CONSTRUCTOR: + return new PageBlockSubheader(input); + case PageBlockKicker.CONSTRUCTOR: + return new PageBlockKicker(input); + case PageBlockParagraph.CONSTRUCTOR: + return new PageBlockParagraph(input); + case PageBlockPreformatted.CONSTRUCTOR: + return new PageBlockPreformatted(input); + case PageBlockFooter.CONSTRUCTOR: + return new PageBlockFooter(input); + case PageBlockDivider.CONSTRUCTOR: + return new PageBlockDivider(input); + case PageBlockAnchor.CONSTRUCTOR: + return new PageBlockAnchor(input); + case PageBlockList.CONSTRUCTOR: + return new PageBlockList(input); + case PageBlockBlockQuote.CONSTRUCTOR: + return new PageBlockBlockQuote(input); + case PageBlockPullQuote.CONSTRUCTOR: + return new PageBlockPullQuote(input); + case PageBlockAnimation.CONSTRUCTOR: + return new PageBlockAnimation(input); + case PageBlockAudio.CONSTRUCTOR: + return new PageBlockAudio(input); + case PageBlockPhoto.CONSTRUCTOR: + return new PageBlockPhoto(input); + case PageBlockVideo.CONSTRUCTOR: + return new PageBlockVideo(input); + case PageBlockVoiceNote.CONSTRUCTOR: + return new PageBlockVoiceNote(input); + case PageBlockCover.CONSTRUCTOR: + return new PageBlockCover(input); + case PageBlockEmbedded.CONSTRUCTOR: + return new PageBlockEmbedded(input); + case PageBlockEmbeddedPost.CONSTRUCTOR: + return new PageBlockEmbeddedPost(input); + case PageBlockCollage.CONSTRUCTOR: + return new PageBlockCollage(input); + case PageBlockSlideshow.CONSTRUCTOR: + return new PageBlockSlideshow(input); + case PageBlockChatLink.CONSTRUCTOR: + return new PageBlockChatLink(input); + case PageBlockTable.CONSTRUCTOR: + return new PageBlockTable(input); + case PageBlockDetails.CONSTRUCTOR: + return new PageBlockDetails(input); + case PageBlockRelatedArticles.CONSTRUCTOR: + return new PageBlockRelatedArticles(input); + case PageBlockMap.CONSTRUCTOR: + return new PageBlockMap(input); + case PageBlockCaption.CONSTRUCTOR: + return new PageBlockCaption(input); + case PageBlockHorizontalAlignmentLeft.CONSTRUCTOR: + return new PageBlockHorizontalAlignmentLeft(input); + case PageBlockHorizontalAlignmentCenter.CONSTRUCTOR: + return new PageBlockHorizontalAlignmentCenter(input); + case PageBlockHorizontalAlignmentRight.CONSTRUCTOR: + return new PageBlockHorizontalAlignmentRight(input); + case PageBlockListItem.CONSTRUCTOR: + return new PageBlockListItem(input); + case PageBlockRelatedArticle.CONSTRUCTOR: + return new PageBlockRelatedArticle(input); + case PageBlockTableCell.CONSTRUCTOR: + return new PageBlockTableCell(input); + case PageBlockVerticalAlignmentTop.CONSTRUCTOR: + return new PageBlockVerticalAlignmentTop(input); + case PageBlockVerticalAlignmentMiddle.CONSTRUCTOR: + return new PageBlockVerticalAlignmentMiddle(input); + case PageBlockVerticalAlignmentBottom.CONSTRUCTOR: + return new PageBlockVerticalAlignmentBottom(input); + case PassportAuthorizationForm.CONSTRUCTOR: + return new PassportAuthorizationForm(input); + case PassportElementPersonalDetails.CONSTRUCTOR: + return new PassportElementPersonalDetails(input); + case PassportElementPassport.CONSTRUCTOR: + return new PassportElementPassport(input); + case PassportElementDriverLicense.CONSTRUCTOR: + return new PassportElementDriverLicense(input); + case PassportElementIdentityCard.CONSTRUCTOR: + return new PassportElementIdentityCard(input); + case PassportElementInternalPassport.CONSTRUCTOR: + return new PassportElementInternalPassport(input); + case PassportElementAddress.CONSTRUCTOR: + return new PassportElementAddress(input); + case PassportElementUtilityBill.CONSTRUCTOR: + return new PassportElementUtilityBill(input); + case PassportElementBankStatement.CONSTRUCTOR: + return new PassportElementBankStatement(input); + case PassportElementRentalAgreement.CONSTRUCTOR: + return new PassportElementRentalAgreement(input); + case PassportElementPassportRegistration.CONSTRUCTOR: + return new PassportElementPassportRegistration(input); + case PassportElementTemporaryRegistration.CONSTRUCTOR: + return new PassportElementTemporaryRegistration(input); + case PassportElementPhoneNumber.CONSTRUCTOR: + return new PassportElementPhoneNumber(input); + case PassportElementEmailAddress.CONSTRUCTOR: + return new PassportElementEmailAddress(input); + case PassportElementError.CONSTRUCTOR: + return new PassportElementError(input); + case PassportElementErrorSourceUnspecified.CONSTRUCTOR: + return new PassportElementErrorSourceUnspecified(input); + case PassportElementErrorSourceDataField.CONSTRUCTOR: + return new PassportElementErrorSourceDataField(input); + case PassportElementErrorSourceFrontSide.CONSTRUCTOR: + return new PassportElementErrorSourceFrontSide(input); + case PassportElementErrorSourceReverseSide.CONSTRUCTOR: + return new PassportElementErrorSourceReverseSide(input); + case PassportElementErrorSourceSelfie.CONSTRUCTOR: + return new PassportElementErrorSourceSelfie(input); + case PassportElementErrorSourceTranslationFile.CONSTRUCTOR: + return new PassportElementErrorSourceTranslationFile(input); + case PassportElementErrorSourceTranslationFiles.CONSTRUCTOR: + return new PassportElementErrorSourceTranslationFiles(input); + case PassportElementErrorSourceFile.CONSTRUCTOR: + return new PassportElementErrorSourceFile(input); + case PassportElementErrorSourceFiles.CONSTRUCTOR: + return new PassportElementErrorSourceFiles(input); + case PassportElementTypePersonalDetails.CONSTRUCTOR: + return new PassportElementTypePersonalDetails(input); + case PassportElementTypePassport.CONSTRUCTOR: + return new PassportElementTypePassport(input); + case PassportElementTypeDriverLicense.CONSTRUCTOR: + return new PassportElementTypeDriverLicense(input); + case PassportElementTypeIdentityCard.CONSTRUCTOR: + return new PassportElementTypeIdentityCard(input); + case PassportElementTypeInternalPassport.CONSTRUCTOR: + return new PassportElementTypeInternalPassport(input); + case PassportElementTypeAddress.CONSTRUCTOR: + return new PassportElementTypeAddress(input); + case PassportElementTypeUtilityBill.CONSTRUCTOR: + return new PassportElementTypeUtilityBill(input); + case PassportElementTypeBankStatement.CONSTRUCTOR: + return new PassportElementTypeBankStatement(input); + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + return new PassportElementTypeRentalAgreement(input); + case PassportElementTypePassportRegistration.CONSTRUCTOR: + return new PassportElementTypePassportRegistration(input); + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + return new PassportElementTypeTemporaryRegistration(input); + case PassportElementTypePhoneNumber.CONSTRUCTOR: + return new PassportElementTypePhoneNumber(input); + case PassportElementTypeEmailAddress.CONSTRUCTOR: + return new PassportElementTypeEmailAddress(input); + case PassportElements.CONSTRUCTOR: + return new PassportElements(input); + case PassportElementsWithErrors.CONSTRUCTOR: + return new PassportElementsWithErrors(input); + case PassportRequiredElement.CONSTRUCTOR: + return new PassportRequiredElement(input); + case PassportSuitableElement.CONSTRUCTOR: + return new PassportSuitableElement(input); + case PasswordState.CONSTRUCTOR: + return new PasswordState(input); + case PaymentForm.CONSTRUCTOR: + return new PaymentForm(input); + case PaymentReceipt.CONSTRUCTOR: + return new PaymentReceipt(input); + case PaymentResult.CONSTRUCTOR: + return new PaymentResult(input); + case PaymentsProviderStripe.CONSTRUCTOR: + return new PaymentsProviderStripe(input); + case PersonalDetails.CONSTRUCTOR: + return new PersonalDetails(input); + case PersonalDocument.CONSTRUCTOR: + return new PersonalDocument(input); + case PhoneNumberAuthenticationSettings.CONSTRUCTOR: + return new PhoneNumberAuthenticationSettings(input); + case Photo.CONSTRUCTOR: + return new Photo(input); + case PhotoSize.CONSTRUCTOR: + return new PhotoSize(input); + case Poll.CONSTRUCTOR: + return new Poll(input); + case PollOption.CONSTRUCTOR: + return new PollOption(input); + case PollTypeRegular.CONSTRUCTOR: + return new PollTypeRegular(input); + case PollTypeQuiz.CONSTRUCTOR: + return new PollTypeQuiz(input); + case ProfilePhoto.CONSTRUCTOR: + return new ProfilePhoto(input); + case Proxies.CONSTRUCTOR: + return new Proxies(input); + case Proxy.CONSTRUCTOR: + return new Proxy(input); + case ProxyTypeSocks5.CONSTRUCTOR: + return new ProxyTypeSocks5(input); + case ProxyTypeHttp.CONSTRUCTOR: + return new ProxyTypeHttp(input); + case ProxyTypeMtproto.CONSTRUCTOR: + return new ProxyTypeMtproto(input); + case PublicChatTypeHasUsername.CONSTRUCTOR: + return new PublicChatTypeHasUsername(input); + case PublicChatTypeIsLocationBased.CONSTRUCTOR: + return new PublicChatTypeIsLocationBased(input); + case PublicMessageLink.CONSTRUCTOR: + return new PublicMessageLink(input); + case PushMessageContentHidden.CONSTRUCTOR: + return new PushMessageContentHidden(input); + case PushMessageContentAnimation.CONSTRUCTOR: + return new PushMessageContentAnimation(input); + case PushMessageContentAudio.CONSTRUCTOR: + return new PushMessageContentAudio(input); + case PushMessageContentContact.CONSTRUCTOR: + return new PushMessageContentContact(input); + case PushMessageContentContactRegistered.CONSTRUCTOR: + return new PushMessageContentContactRegistered(input); + case PushMessageContentDocument.CONSTRUCTOR: + return new PushMessageContentDocument(input); + case PushMessageContentGame.CONSTRUCTOR: + return new PushMessageContentGame(input); + case PushMessageContentGameScore.CONSTRUCTOR: + return new PushMessageContentGameScore(input); + case PushMessageContentInvoice.CONSTRUCTOR: + return new PushMessageContentInvoice(input); + case PushMessageContentLocation.CONSTRUCTOR: + return new PushMessageContentLocation(input); + case PushMessageContentPhoto.CONSTRUCTOR: + return new PushMessageContentPhoto(input); + case PushMessageContentPoll.CONSTRUCTOR: + return new PushMessageContentPoll(input); + case PushMessageContentScreenshotTaken.CONSTRUCTOR: + return new PushMessageContentScreenshotTaken(input); + case PushMessageContentSticker.CONSTRUCTOR: + return new PushMessageContentSticker(input); + case PushMessageContentText.CONSTRUCTOR: + return new PushMessageContentText(input); + case PushMessageContentVideo.CONSTRUCTOR: + return new PushMessageContentVideo(input); + case PushMessageContentVideoNote.CONSTRUCTOR: + return new PushMessageContentVideoNote(input); + case PushMessageContentVoiceNote.CONSTRUCTOR: + return new PushMessageContentVoiceNote(input); + case PushMessageContentBasicGroupChatCreate.CONSTRUCTOR: + return new PushMessageContentBasicGroupChatCreate(input); + case PushMessageContentChatAddMembers.CONSTRUCTOR: + return new PushMessageContentChatAddMembers(input); + case PushMessageContentChatChangePhoto.CONSTRUCTOR: + return new PushMessageContentChatChangePhoto(input); + case PushMessageContentChatChangeTitle.CONSTRUCTOR: + return new PushMessageContentChatChangeTitle(input); + case PushMessageContentChatDeleteMember.CONSTRUCTOR: + return new PushMessageContentChatDeleteMember(input); + case PushMessageContentChatJoinByLink.CONSTRUCTOR: + return new PushMessageContentChatJoinByLink(input); + case PushMessageContentMessageForwards.CONSTRUCTOR: + return new PushMessageContentMessageForwards(input); + case PushMessageContentMediaAlbum.CONSTRUCTOR: + return new PushMessageContentMediaAlbum(input); + case PushReceiverId.CONSTRUCTOR: + return new PushReceiverId(input); + case RecoveryEmailAddress.CONSTRUCTOR: + return new RecoveryEmailAddress(input); + case RemoteFile.CONSTRUCTOR: + return new RemoteFile(input); + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + return new ReplyMarkupRemoveKeyboard(input); + case ReplyMarkupForceReply.CONSTRUCTOR: + return new ReplyMarkupForceReply(input); + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + return new ReplyMarkupShowKeyboard(input); + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + return new ReplyMarkupInlineKeyboard(input); + case RichTextPlain.CONSTRUCTOR: + return new RichTextPlain(input); + case RichTextBold.CONSTRUCTOR: + return new RichTextBold(input); + case RichTextItalic.CONSTRUCTOR: + return new RichTextItalic(input); + case RichTextUnderline.CONSTRUCTOR: + return new RichTextUnderline(input); + case RichTextStrikethrough.CONSTRUCTOR: + return new RichTextStrikethrough(input); + case RichTextFixed.CONSTRUCTOR: + return new RichTextFixed(input); + case RichTextUrl.CONSTRUCTOR: + return new RichTextUrl(input); + case RichTextEmailAddress.CONSTRUCTOR: + return new RichTextEmailAddress(input); + case RichTextSubscript.CONSTRUCTOR: + return new RichTextSubscript(input); + case RichTextSuperscript.CONSTRUCTOR: + return new RichTextSuperscript(input); + case RichTextMarked.CONSTRUCTOR: + return new RichTextMarked(input); + case RichTextPhoneNumber.CONSTRUCTOR: + return new RichTextPhoneNumber(input); + case RichTextIcon.CONSTRUCTOR: + return new RichTextIcon(input); + case RichTextReference.CONSTRUCTOR: + return new RichTextReference(input); + case RichTextAnchor.CONSTRUCTOR: + return new RichTextAnchor(input); + case RichTextAnchorLink.CONSTRUCTOR: + return new RichTextAnchorLink(input); + case RichTexts.CONSTRUCTOR: + return new RichTexts(input); + case SavedCredentials.CONSTRUCTOR: + return new SavedCredentials(input); + case ScopeNotificationSettings.CONSTRUCTOR: + return new ScopeNotificationSettings(input); + case SearchMessagesFilterEmpty.CONSTRUCTOR: + return new SearchMessagesFilterEmpty(input); + case SearchMessagesFilterAnimation.CONSTRUCTOR: + return new SearchMessagesFilterAnimation(input); + case SearchMessagesFilterAudio.CONSTRUCTOR: + return new SearchMessagesFilterAudio(input); + case SearchMessagesFilterDocument.CONSTRUCTOR: + return new SearchMessagesFilterDocument(input); + case SearchMessagesFilterPhoto.CONSTRUCTOR: + return new SearchMessagesFilterPhoto(input); + case SearchMessagesFilterVideo.CONSTRUCTOR: + return new SearchMessagesFilterVideo(input); + case SearchMessagesFilterVoiceNote.CONSTRUCTOR: + return new SearchMessagesFilterVoiceNote(input); + case SearchMessagesFilterPhotoAndVideo.CONSTRUCTOR: + return new SearchMessagesFilterPhotoAndVideo(input); + case SearchMessagesFilterUrl.CONSTRUCTOR: + return new SearchMessagesFilterUrl(input); + case SearchMessagesFilterChatPhoto.CONSTRUCTOR: + return new SearchMessagesFilterChatPhoto(input); + case SearchMessagesFilterCall.CONSTRUCTOR: + return new SearchMessagesFilterCall(input); + case SearchMessagesFilterMissedCall.CONSTRUCTOR: + return new SearchMessagesFilterMissedCall(input); + case SearchMessagesFilterVideoNote.CONSTRUCTOR: + return new SearchMessagesFilterVideoNote(input); + case SearchMessagesFilterVoiceAndVideoNote.CONSTRUCTOR: + return new SearchMessagesFilterVoiceAndVideoNote(input); + case SearchMessagesFilterMention.CONSTRUCTOR: + return new SearchMessagesFilterMention(input); + case SearchMessagesFilterUnreadMention.CONSTRUCTOR: + return new SearchMessagesFilterUnreadMention(input); + case Seconds.CONSTRUCTOR: + return new Seconds(input); + case SecretChat.CONSTRUCTOR: + return new SecretChat(input); + case SecretChatStatePending.CONSTRUCTOR: + return new SecretChatStatePending(input); + case SecretChatStateReady.CONSTRUCTOR: + return new SecretChatStateReady(input); + case SecretChatStateClosed.CONSTRUCTOR: + return new SecretChatStateClosed(input); + case SendMessageOptions.CONSTRUCTOR: + return new SendMessageOptions(input); + case Session.CONSTRUCTOR: + return new Session(input); + case Sessions.CONSTRUCTOR: + return new Sessions(input); + case ShippingOption.CONSTRUCTOR: + return new ShippingOption(input); + case StatisticsGraphData.CONSTRUCTOR: + return new StatisticsGraphData(input); + case StatisticsGraphAsync.CONSTRUCTOR: + return new StatisticsGraphAsync(input); + case StatisticsGraphError.CONSTRUCTOR: + return new StatisticsGraphError(input); + case StatisticsValue.CONSTRUCTOR: + return new StatisticsValue(input); + case Sticker.CONSTRUCTOR: + return new Sticker(input); + case StickerSet.CONSTRUCTOR: + return new StickerSet(input); + case StickerSetInfo.CONSTRUCTOR: + return new StickerSetInfo(input); + case StickerSets.CONSTRUCTOR: + return new StickerSets(input); + case Stickers.CONSTRUCTOR: + return new Stickers(input); + case StorageStatistics.CONSTRUCTOR: + return new StorageStatistics(input); + case StorageStatisticsByChat.CONSTRUCTOR: + return new StorageStatisticsByChat(input); + case StorageStatisticsByFileType.CONSTRUCTOR: + return new StorageStatisticsByFileType(input); + case StorageStatisticsFast.CONSTRUCTOR: + return new StorageStatisticsFast(input); + case Supergroup.CONSTRUCTOR: + return new Supergroup(input); + case SupergroupFullInfo.CONSTRUCTOR: + return new SupergroupFullInfo(input); + case SupergroupMembersFilterRecent.CONSTRUCTOR: + return new SupergroupMembersFilterRecent(input); + case SupergroupMembersFilterContacts.CONSTRUCTOR: + return new SupergroupMembersFilterContacts(input); + case SupergroupMembersFilterAdministrators.CONSTRUCTOR: + return new SupergroupMembersFilterAdministrators(input); + case SupergroupMembersFilterSearch.CONSTRUCTOR: + return new SupergroupMembersFilterSearch(input); + case SupergroupMembersFilterRestricted.CONSTRUCTOR: + return new SupergroupMembersFilterRestricted(input); + case SupergroupMembersFilterBanned.CONSTRUCTOR: + return new SupergroupMembersFilterBanned(input); + case SupergroupMembersFilterBots.CONSTRUCTOR: + return new SupergroupMembersFilterBots(input); + case TMeUrl.CONSTRUCTOR: + return new TMeUrl(input); + case TMeUrlTypeUser.CONSTRUCTOR: + return new TMeUrlTypeUser(input); + case TMeUrlTypeSupergroup.CONSTRUCTOR: + return new TMeUrlTypeSupergroup(input); + case TMeUrlTypeChatInvite.CONSTRUCTOR: + return new TMeUrlTypeChatInvite(input); + case TMeUrlTypeStickerSet.CONSTRUCTOR: + return new TMeUrlTypeStickerSet(input); + case TMeUrls.CONSTRUCTOR: + return new TMeUrls(input); + case TdlibParameters.CONSTRUCTOR: + return new TdlibParameters(input); + case TemporaryPasswordState.CONSTRUCTOR: + return new TemporaryPasswordState(input); + case TermsOfService.CONSTRUCTOR: + return new TermsOfService(input); + case TestBytes.CONSTRUCTOR: + return new TestBytes(input); + case TestInt.CONSTRUCTOR: + return new TestInt(input); + case TestString.CONSTRUCTOR: + return new TestString(input); + case TestVectorInt.CONSTRUCTOR: + return new TestVectorInt(input); + case TestVectorIntObject.CONSTRUCTOR: + return new TestVectorIntObject(input); + case TestVectorString.CONSTRUCTOR: + return new TestVectorString(input); + case TestVectorStringObject.CONSTRUCTOR: + return new TestVectorStringObject(input); + case Text.CONSTRUCTOR: + return new Text(input); + case TextEntities.CONSTRUCTOR: + return new TextEntities(input); + case TextEntity.CONSTRUCTOR: + return new TextEntity(input); + case TextEntityTypeMention.CONSTRUCTOR: + return new TextEntityTypeMention(input); + case TextEntityTypeHashtag.CONSTRUCTOR: + return new TextEntityTypeHashtag(input); + case TextEntityTypeCashtag.CONSTRUCTOR: + return new TextEntityTypeCashtag(input); + case TextEntityTypeBotCommand.CONSTRUCTOR: + return new TextEntityTypeBotCommand(input); + case TextEntityTypeUrl.CONSTRUCTOR: + return new TextEntityTypeUrl(input); + case TextEntityTypeEmailAddress.CONSTRUCTOR: + return new TextEntityTypeEmailAddress(input); + case TextEntityTypePhoneNumber.CONSTRUCTOR: + return new TextEntityTypePhoneNumber(input); + case TextEntityTypeBankCardNumber.CONSTRUCTOR: + return new TextEntityTypeBankCardNumber(input); + case TextEntityTypeBold.CONSTRUCTOR: + return new TextEntityTypeBold(input); + case TextEntityTypeItalic.CONSTRUCTOR: + return new TextEntityTypeItalic(input); + case TextEntityTypeUnderline.CONSTRUCTOR: + return new TextEntityTypeUnderline(input); + case TextEntityTypeStrikethrough.CONSTRUCTOR: + return new TextEntityTypeStrikethrough(input); + case TextEntityTypeCode.CONSTRUCTOR: + return new TextEntityTypeCode(input); + case TextEntityTypePre.CONSTRUCTOR: + return new TextEntityTypePre(input); + case TextEntityTypePreCode.CONSTRUCTOR: + return new TextEntityTypePreCode(input); + case TextEntityTypeTextUrl.CONSTRUCTOR: + return new TextEntityTypeTextUrl(input); + case TextEntityTypeMentionName.CONSTRUCTOR: + return new TextEntityTypeMentionName(input); + case TextParseModeMarkdown.CONSTRUCTOR: + return new TextParseModeMarkdown(input); + case TextParseModeHTML.CONSTRUCTOR: + return new TextParseModeHTML(input); + case TopChatCategoryUsers.CONSTRUCTOR: + return new TopChatCategoryUsers(input); + case TopChatCategoryBots.CONSTRUCTOR: + return new TopChatCategoryBots(input); + case TopChatCategoryGroups.CONSTRUCTOR: + return new TopChatCategoryGroups(input); + case TopChatCategoryChannels.CONSTRUCTOR: + return new TopChatCategoryChannels(input); + case TopChatCategoryInlineBots.CONSTRUCTOR: + return new TopChatCategoryInlineBots(input); + case TopChatCategoryCalls.CONSTRUCTOR: + return new TopChatCategoryCalls(input); + case TopChatCategoryForwardChats.CONSTRUCTOR: + return new TopChatCategoryForwardChats(input); + case UpdateAuthorizationState.CONSTRUCTOR: + return new UpdateAuthorizationState(input); + case UpdateNewMessage.CONSTRUCTOR: + return new UpdateNewMessage(input); + case UpdateMessageSendAcknowledged.CONSTRUCTOR: + return new UpdateMessageSendAcknowledged(input); + case UpdateMessageSendSucceeded.CONSTRUCTOR: + return new UpdateMessageSendSucceeded(input); + case UpdateMessageSendFailed.CONSTRUCTOR: + return new UpdateMessageSendFailed(input); + case UpdateMessageContent.CONSTRUCTOR: + return new UpdateMessageContent(input); + case UpdateMessageEdited.CONSTRUCTOR: + return new UpdateMessageEdited(input); + case UpdateMessageViews.CONSTRUCTOR: + return new UpdateMessageViews(input); + case UpdateMessageContentOpened.CONSTRUCTOR: + return new UpdateMessageContentOpened(input); + case UpdateMessageMentionRead.CONSTRUCTOR: + return new UpdateMessageMentionRead(input); + case UpdateMessageLiveLocationViewed.CONSTRUCTOR: + return new UpdateMessageLiveLocationViewed(input); + case UpdateNewChat.CONSTRUCTOR: + return new UpdateNewChat(input); + case UpdateChatChatList.CONSTRUCTOR: + return new UpdateChatChatList(input); + case UpdateChatTitle.CONSTRUCTOR: + return new UpdateChatTitle(input); + case UpdateChatPhoto.CONSTRUCTOR: + return new UpdateChatPhoto(input); + case UpdateChatPermissions.CONSTRUCTOR: + return new UpdateChatPermissions(input); + case UpdateChatLastMessage.CONSTRUCTOR: + return new UpdateChatLastMessage(input); + case UpdateChatOrder.CONSTRUCTOR: + return new UpdateChatOrder(input); + case UpdateChatIsPinned.CONSTRUCTOR: + return new UpdateChatIsPinned(input); + case UpdateChatIsMarkedAsUnread.CONSTRUCTOR: + return new UpdateChatIsMarkedAsUnread(input); + case UpdateChatIsSponsored.CONSTRUCTOR: + return new UpdateChatIsSponsored(input); + case UpdateChatHasScheduledMessages.CONSTRUCTOR: + return new UpdateChatHasScheduledMessages(input); + case UpdateChatDefaultDisableNotification.CONSTRUCTOR: + return new UpdateChatDefaultDisableNotification(input); + case UpdateChatReadInbox.CONSTRUCTOR: + return new UpdateChatReadInbox(input); + case UpdateChatReadOutbox.CONSTRUCTOR: + return new UpdateChatReadOutbox(input); + case UpdateChatUnreadMentionCount.CONSTRUCTOR: + return new UpdateChatUnreadMentionCount(input); + case UpdateChatNotificationSettings.CONSTRUCTOR: + return new UpdateChatNotificationSettings(input); + case UpdateScopeNotificationSettings.CONSTRUCTOR: + return new UpdateScopeNotificationSettings(input); + case UpdateChatActionBar.CONSTRUCTOR: + return new UpdateChatActionBar(input); + case UpdateChatPinnedMessage.CONSTRUCTOR: + return new UpdateChatPinnedMessage(input); + case UpdateChatReplyMarkup.CONSTRUCTOR: + return new UpdateChatReplyMarkup(input); + case UpdateChatDraftMessage.CONSTRUCTOR: + return new UpdateChatDraftMessage(input); + case UpdateChatOnlineMemberCount.CONSTRUCTOR: + return new UpdateChatOnlineMemberCount(input); + case UpdateNotification.CONSTRUCTOR: + return new UpdateNotification(input); + case UpdateNotificationGroup.CONSTRUCTOR: + return new UpdateNotificationGroup(input); + case UpdateActiveNotifications.CONSTRUCTOR: + return new UpdateActiveNotifications(input); + case UpdateHavePendingNotifications.CONSTRUCTOR: + return new UpdateHavePendingNotifications(input); + case UpdateDeleteMessages.CONSTRUCTOR: + return new UpdateDeleteMessages(input); + case UpdateUserChatAction.CONSTRUCTOR: + return new UpdateUserChatAction(input); + case UpdateUserStatus.CONSTRUCTOR: + return new UpdateUserStatus(input); + case UpdateUser.CONSTRUCTOR: + return new UpdateUser(input); + case UpdateBasicGroup.CONSTRUCTOR: + return new UpdateBasicGroup(input); + case UpdateSupergroup.CONSTRUCTOR: + return new UpdateSupergroup(input); + case UpdateSecretChat.CONSTRUCTOR: + return new UpdateSecretChat(input); + case UpdateUserFullInfo.CONSTRUCTOR: + return new UpdateUserFullInfo(input); + case UpdateBasicGroupFullInfo.CONSTRUCTOR: + return new UpdateBasicGroupFullInfo(input); + case UpdateSupergroupFullInfo.CONSTRUCTOR: + return new UpdateSupergroupFullInfo(input); + case UpdateServiceNotification.CONSTRUCTOR: + return new UpdateServiceNotification(input); + case UpdateFile.CONSTRUCTOR: + return new UpdateFile(input); + case UpdateFileGenerationStart.CONSTRUCTOR: + return new UpdateFileGenerationStart(input); + case UpdateFileGenerationStop.CONSTRUCTOR: + return new UpdateFileGenerationStop(input); + case UpdateCall.CONSTRUCTOR: + return new UpdateCall(input); + case UpdateUserPrivacySettingRules.CONSTRUCTOR: + return new UpdateUserPrivacySettingRules(input); + case UpdateUnreadMessageCount.CONSTRUCTOR: + return new UpdateUnreadMessageCount(input); + case UpdateUnreadChatCount.CONSTRUCTOR: + return new UpdateUnreadChatCount(input); + case UpdateOption.CONSTRUCTOR: + return new UpdateOption(input); + case UpdateStickerSet.CONSTRUCTOR: + return new UpdateStickerSet(input); + case UpdateInstalledStickerSets.CONSTRUCTOR: + return new UpdateInstalledStickerSets(input); + case UpdateTrendingStickerSets.CONSTRUCTOR: + return new UpdateTrendingStickerSets(input); + case UpdateRecentStickers.CONSTRUCTOR: + return new UpdateRecentStickers(input); + case UpdateFavoriteStickers.CONSTRUCTOR: + return new UpdateFavoriteStickers(input); + case UpdateSavedAnimations.CONSTRUCTOR: + return new UpdateSavedAnimations(input); + case UpdateSelectedBackground.CONSTRUCTOR: + return new UpdateSelectedBackground(input); + case UpdateLanguagePackStrings.CONSTRUCTOR: + return new UpdateLanguagePackStrings(input); + case UpdateConnectionState.CONSTRUCTOR: + return new UpdateConnectionState(input); + case UpdateTermsOfService.CONSTRUCTOR: + return new UpdateTermsOfService(input); + case UpdateUsersNearby.CONSTRUCTOR: + return new UpdateUsersNearby(input); + case UpdateDiceEmojis.CONSTRUCTOR: + return new UpdateDiceEmojis(input); + case UpdateNewInlineQuery.CONSTRUCTOR: + return new UpdateNewInlineQuery(input); + case UpdateNewChosenInlineResult.CONSTRUCTOR: + return new UpdateNewChosenInlineResult(input); + case UpdateNewCallbackQuery.CONSTRUCTOR: + return new UpdateNewCallbackQuery(input); + case UpdateNewInlineCallbackQuery.CONSTRUCTOR: + return new UpdateNewInlineCallbackQuery(input); + case UpdateNewShippingQuery.CONSTRUCTOR: + return new UpdateNewShippingQuery(input); + case UpdateNewPreCheckoutQuery.CONSTRUCTOR: + return new UpdateNewPreCheckoutQuery(input); + case UpdateNewCustomEvent.CONSTRUCTOR: + return new UpdateNewCustomEvent(input); + case UpdateNewCustomQuery.CONSTRUCTOR: + return new UpdateNewCustomQuery(input); + case UpdatePoll.CONSTRUCTOR: + return new UpdatePoll(input); + case UpdatePollAnswer.CONSTRUCTOR: + return new UpdatePollAnswer(input); + case Updates.CONSTRUCTOR: + return new Updates(input); + case User.CONSTRUCTOR: + return new User(input); + case UserFullInfo.CONSTRUCTOR: + return new UserFullInfo(input); + case UserPrivacySettingShowStatus.CONSTRUCTOR: + return new UserPrivacySettingShowStatus(input); + case UserPrivacySettingShowProfilePhoto.CONSTRUCTOR: + return new UserPrivacySettingShowProfilePhoto(input); + case UserPrivacySettingShowLinkInForwardedMessages.CONSTRUCTOR: + return new UserPrivacySettingShowLinkInForwardedMessages(input); + case UserPrivacySettingShowPhoneNumber.CONSTRUCTOR: + return new UserPrivacySettingShowPhoneNumber(input); + case UserPrivacySettingAllowChatInvites.CONSTRUCTOR: + return new UserPrivacySettingAllowChatInvites(input); + case UserPrivacySettingAllowCalls.CONSTRUCTOR: + return new UserPrivacySettingAllowCalls(input); + case UserPrivacySettingAllowPeerToPeerCalls.CONSTRUCTOR: + return new UserPrivacySettingAllowPeerToPeerCalls(input); + case UserPrivacySettingAllowFindingByPhoneNumber.CONSTRUCTOR: + return new UserPrivacySettingAllowFindingByPhoneNumber(input); + case UserPrivacySettingRuleAllowAll.CONSTRUCTOR: + return new UserPrivacySettingRuleAllowAll(input); + case UserPrivacySettingRuleAllowContacts.CONSTRUCTOR: + return new UserPrivacySettingRuleAllowContacts(input); + case UserPrivacySettingRuleAllowUsers.CONSTRUCTOR: + return new UserPrivacySettingRuleAllowUsers(input); + case UserPrivacySettingRuleAllowChatMembers.CONSTRUCTOR: + return new UserPrivacySettingRuleAllowChatMembers(input); + case UserPrivacySettingRuleRestrictAll.CONSTRUCTOR: + return new UserPrivacySettingRuleRestrictAll(input); + case UserPrivacySettingRuleRestrictContacts.CONSTRUCTOR: + return new UserPrivacySettingRuleRestrictContacts(input); + case UserPrivacySettingRuleRestrictUsers.CONSTRUCTOR: + return new UserPrivacySettingRuleRestrictUsers(input); + case UserPrivacySettingRuleRestrictChatMembers.CONSTRUCTOR: + return new UserPrivacySettingRuleRestrictChatMembers(input); + case UserPrivacySettingRules.CONSTRUCTOR: + return new UserPrivacySettingRules(input); + case UserProfilePhoto.CONSTRUCTOR: + return new UserProfilePhoto(input); + case UserProfilePhotos.CONSTRUCTOR: + return new UserProfilePhotos(input); + case UserStatusEmpty.CONSTRUCTOR: + return new UserStatusEmpty(input); + case UserStatusOnline.CONSTRUCTOR: + return new UserStatusOnline(input); + case UserStatusOffline.CONSTRUCTOR: + return new UserStatusOffline(input); + case UserStatusRecently.CONSTRUCTOR: + return new UserStatusRecently(input); + case UserStatusLastWeek.CONSTRUCTOR: + return new UserStatusLastWeek(input); + case UserStatusLastMonth.CONSTRUCTOR: + return new UserStatusLastMonth(input); + case UserTypeRegular.CONSTRUCTOR: + return new UserTypeRegular(input); + case UserTypeDeleted.CONSTRUCTOR: + return new UserTypeDeleted(input); + case UserTypeBot.CONSTRUCTOR: + return new UserTypeBot(input); + case UserTypeUnknown.CONSTRUCTOR: + return new UserTypeUnknown(input); + case Users.CONSTRUCTOR: + return new Users(input); + case ValidatedOrderInfo.CONSTRUCTOR: + return new ValidatedOrderInfo(input); + case Venue.CONSTRUCTOR: + return new Venue(input); + case Video.CONSTRUCTOR: + return new Video(input); + case VideoNote.CONSTRUCTOR: + return new VideoNote(input); + case VoiceNote.CONSTRUCTOR: + return new VoiceNote(input); + case WebPage.CONSTRUCTOR: + return new WebPage(input); + case WebPageInstantView.CONSTRUCTOR: + return new WebPageInstantView(input); + case AcceptCall.CONSTRUCTOR: + return new AcceptCall(input); + case AcceptTermsOfService.CONSTRUCTOR: + return new AcceptTermsOfService(input); + case AddChatMember.CONSTRUCTOR: + return new AddChatMember(input); + case AddChatMembers.CONSTRUCTOR: + return new AddChatMembers(input); + case AddContact.CONSTRUCTOR: + return new AddContact(input); + case AddCustomServerLanguagePack.CONSTRUCTOR: + return new AddCustomServerLanguagePack(input); + case AddFavoriteSticker.CONSTRUCTOR: + return new AddFavoriteSticker(input); + case AddLocalMessage.CONSTRUCTOR: + return new AddLocalMessage(input); + case AddLogMessage.CONSTRUCTOR: + return new AddLogMessage(input); + case AddNetworkStatistics.CONSTRUCTOR: + return new AddNetworkStatistics(input); + case AddProxy.CONSTRUCTOR: + return new AddProxy(input); + case AddRecentSticker.CONSTRUCTOR: + return new AddRecentSticker(input); + case AddRecentlyFoundChat.CONSTRUCTOR: + return new AddRecentlyFoundChat(input); + case AddSavedAnimation.CONSTRUCTOR: + return new AddSavedAnimation(input); + case AddStickerToSet.CONSTRUCTOR: + return new AddStickerToSet(input); + case AnswerCallbackQuery.CONSTRUCTOR: + return new AnswerCallbackQuery(input); + case AnswerCustomQuery.CONSTRUCTOR: + return new AnswerCustomQuery(input); + case AnswerInlineQuery.CONSTRUCTOR: + return new AnswerInlineQuery(input); + case AnswerPreCheckoutQuery.CONSTRUCTOR: + return new AnswerPreCheckoutQuery(input); + case AnswerShippingQuery.CONSTRUCTOR: + return new AnswerShippingQuery(input); + case BlockUser.CONSTRUCTOR: + return new BlockUser(input); + case CanTransferOwnership.CONSTRUCTOR: + return new CanTransferOwnership(input); + case CancelDownloadFile.CONSTRUCTOR: + return new CancelDownloadFile(input); + case CancelUploadFile.CONSTRUCTOR: + return new CancelUploadFile(input); + case ChangeImportedContacts.CONSTRUCTOR: + return new ChangeImportedContacts(input); + case ChangePhoneNumber.CONSTRUCTOR: + return new ChangePhoneNumber(input); + case ChangeStickerSet.CONSTRUCTOR: + return new ChangeStickerSet(input); + case CheckAuthenticationBotToken.CONSTRUCTOR: + return new CheckAuthenticationBotToken(input); + case CheckAuthenticationCode.CONSTRUCTOR: + return new CheckAuthenticationCode(input); + case CheckAuthenticationPassword.CONSTRUCTOR: + return new CheckAuthenticationPassword(input); + case CheckChangePhoneNumberCode.CONSTRUCTOR: + return new CheckChangePhoneNumberCode(input); + case CheckChatInviteLink.CONSTRUCTOR: + return new CheckChatInviteLink(input); + case CheckChatUsername.CONSTRUCTOR: + return new CheckChatUsername(input); + case CheckCreatedPublicChatsLimit.CONSTRUCTOR: + return new CheckCreatedPublicChatsLimit(input); + case CheckDatabaseEncryptionKey.CONSTRUCTOR: + return new CheckDatabaseEncryptionKey(input); + case CheckEmailAddressVerificationCode.CONSTRUCTOR: + return new CheckEmailAddressVerificationCode(input); + case CheckPhoneNumberConfirmationCode.CONSTRUCTOR: + return new CheckPhoneNumberConfirmationCode(input); + case CheckPhoneNumberVerificationCode.CONSTRUCTOR: + return new CheckPhoneNumberVerificationCode(input); + case CheckRecoveryEmailAddressCode.CONSTRUCTOR: + return new CheckRecoveryEmailAddressCode(input); + case CleanFileName.CONSTRUCTOR: + return new CleanFileName(input); + case ClearAllDraftMessages.CONSTRUCTOR: + return new ClearAllDraftMessages(input); + case ClearImportedContacts.CONSTRUCTOR: + return new ClearImportedContacts(input); + case ClearRecentStickers.CONSTRUCTOR: + return new ClearRecentStickers(input); + case ClearRecentlyFoundChats.CONSTRUCTOR: + return new ClearRecentlyFoundChats(input); + case Close.CONSTRUCTOR: + return new Close(input); + case CloseChat.CONSTRUCTOR: + return new CloseChat(input); + case CloseSecretChat.CONSTRUCTOR: + return new CloseSecretChat(input); + case ConfirmQrCodeAuthentication.CONSTRUCTOR: + return new ConfirmQrCodeAuthentication(input); + case CreateBasicGroupChat.CONSTRUCTOR: + return new CreateBasicGroupChat(input); + case CreateCall.CONSTRUCTOR: + return new CreateCall(input); + case CreateNewBasicGroupChat.CONSTRUCTOR: + return new CreateNewBasicGroupChat(input); + case CreateNewSecretChat.CONSTRUCTOR: + return new CreateNewSecretChat(input); + case CreateNewStickerSet.CONSTRUCTOR: + return new CreateNewStickerSet(input); + case CreateNewSupergroupChat.CONSTRUCTOR: + return new CreateNewSupergroupChat(input); + case CreatePrivateChat.CONSTRUCTOR: + return new CreatePrivateChat(input); + case CreateSecretChat.CONSTRUCTOR: + return new CreateSecretChat(input); + case CreateSupergroupChat.CONSTRUCTOR: + return new CreateSupergroupChat(input); + case CreateTemporaryPassword.CONSTRUCTOR: + return new CreateTemporaryPassword(input); + case DeleteAccount.CONSTRUCTOR: + return new DeleteAccount(input); + case DeleteChatHistory.CONSTRUCTOR: + return new DeleteChatHistory(input); + case DeleteChatMessagesFromUser.CONSTRUCTOR: + return new DeleteChatMessagesFromUser(input); + case DeleteChatReplyMarkup.CONSTRUCTOR: + return new DeleteChatReplyMarkup(input); + case DeleteFile.CONSTRUCTOR: + return new DeleteFile(input); + case DeleteLanguagePack.CONSTRUCTOR: + return new DeleteLanguagePack(input); + case DeleteMessages.CONSTRUCTOR: + return new DeleteMessages(input); + case DeletePassportElement.CONSTRUCTOR: + return new DeletePassportElement(input); + case DeleteProfilePhoto.CONSTRUCTOR: + return new DeleteProfilePhoto(input); + case DeleteSavedCredentials.CONSTRUCTOR: + return new DeleteSavedCredentials(input); + case DeleteSavedOrderInfo.CONSTRUCTOR: + return new DeleteSavedOrderInfo(input); + case DeleteSupergroup.CONSTRUCTOR: + return new DeleteSupergroup(input); + case Destroy.CONSTRUCTOR: + return new Destroy(input); + case DisableProxy.CONSTRUCTOR: + return new DisableProxy(input); + case DiscardCall.CONSTRUCTOR: + return new DiscardCall(input); + case DisconnectAllWebsites.CONSTRUCTOR: + return new DisconnectAllWebsites(input); + case DisconnectWebsite.CONSTRUCTOR: + return new DisconnectWebsite(input); + case DownloadFile.CONSTRUCTOR: + return new DownloadFile(input); + case EditCustomLanguagePackInfo.CONSTRUCTOR: + return new EditCustomLanguagePackInfo(input); + case EditInlineMessageCaption.CONSTRUCTOR: + return new EditInlineMessageCaption(input); + case EditInlineMessageLiveLocation.CONSTRUCTOR: + return new EditInlineMessageLiveLocation(input); + case EditInlineMessageMedia.CONSTRUCTOR: + return new EditInlineMessageMedia(input); + case EditInlineMessageReplyMarkup.CONSTRUCTOR: + return new EditInlineMessageReplyMarkup(input); + case EditInlineMessageText.CONSTRUCTOR: + return new EditInlineMessageText(input); + case EditMessageCaption.CONSTRUCTOR: + return new EditMessageCaption(input); + case EditMessageLiveLocation.CONSTRUCTOR: + return new EditMessageLiveLocation(input); + case EditMessageMedia.CONSTRUCTOR: + return new EditMessageMedia(input); + case EditMessageReplyMarkup.CONSTRUCTOR: + return new EditMessageReplyMarkup(input); + case EditMessageSchedulingState.CONSTRUCTOR: + return new EditMessageSchedulingState(input); + case EditMessageText.CONSTRUCTOR: + return new EditMessageText(input); + case EditProxy.CONSTRUCTOR: + return new EditProxy(input); + case EnableProxy.CONSTRUCTOR: + return new EnableProxy(input); + case FinishFileGeneration.CONSTRUCTOR: + return new FinishFileGeneration(input); + case ForwardMessages.CONSTRUCTOR: + return new ForwardMessages(input); + case GenerateChatInviteLink.CONSTRUCTOR: + return new GenerateChatInviteLink(input); + case GetAccountTtl.CONSTRUCTOR: + return new GetAccountTtl(input); + case GetActiveLiveLocationMessages.CONSTRUCTOR: + return new GetActiveLiveLocationMessages(input); + case GetActiveSessions.CONSTRUCTOR: + return new GetActiveSessions(input); + case GetAllPassportElements.CONSTRUCTOR: + return new GetAllPassportElements(input); + case GetApplicationConfig.CONSTRUCTOR: + return new GetApplicationConfig(input); + case GetArchivedStickerSets.CONSTRUCTOR: + return new GetArchivedStickerSets(input); + case GetAttachedStickerSets.CONSTRUCTOR: + return new GetAttachedStickerSets(input); + case GetAuthorizationState.CONSTRUCTOR: + return new GetAuthorizationState(input); + case GetAutoDownloadSettingsPresets.CONSTRUCTOR: + return new GetAutoDownloadSettingsPresets(input); + case GetBackgroundUrl.CONSTRUCTOR: + return new GetBackgroundUrl(input); + case GetBackgrounds.CONSTRUCTOR: + return new GetBackgrounds(input); + case GetBankCardInfo.CONSTRUCTOR: + return new GetBankCardInfo(input); + case GetBasicGroup.CONSTRUCTOR: + return new GetBasicGroup(input); + case GetBasicGroupFullInfo.CONSTRUCTOR: + return new GetBasicGroupFullInfo(input); + case GetBlockedUsers.CONSTRUCTOR: + return new GetBlockedUsers(input); + case GetCallbackQueryAnswer.CONSTRUCTOR: + return new GetCallbackQueryAnswer(input); + case GetChat.CONSTRUCTOR: + return new GetChat(input); + case GetChatAdministrators.CONSTRUCTOR: + return new GetChatAdministrators(input); + case GetChatEventLog.CONSTRUCTOR: + return new GetChatEventLog(input); + case GetChatHistory.CONSTRUCTOR: + return new GetChatHistory(input); + case GetChatMember.CONSTRUCTOR: + return new GetChatMember(input); + case GetChatMessageByDate.CONSTRUCTOR: + return new GetChatMessageByDate(input); + case GetChatMessageCount.CONSTRUCTOR: + return new GetChatMessageCount(input); + case GetChatNotificationSettingsExceptions.CONSTRUCTOR: + return new GetChatNotificationSettingsExceptions(input); + case GetChatPinnedMessage.CONSTRUCTOR: + return new GetChatPinnedMessage(input); + case GetChatScheduledMessages.CONSTRUCTOR: + return new GetChatScheduledMessages(input); + case GetChatStatistics.CONSTRUCTOR: + return new GetChatStatistics(input); + case GetChatStatisticsGraph.CONSTRUCTOR: + return new GetChatStatisticsGraph(input); + case GetChatStatisticsUrl.CONSTRUCTOR: + return new GetChatStatisticsUrl(input); + case GetChats.CONSTRUCTOR: + return new GetChats(input); + case GetConnectedWebsites.CONSTRUCTOR: + return new GetConnectedWebsites(input); + case GetContacts.CONSTRUCTOR: + return new GetContacts(input); + case GetCountryCode.CONSTRUCTOR: + return new GetCountryCode(input); + case GetCreatedPublicChats.CONSTRUCTOR: + return new GetCreatedPublicChats(input); + case GetCurrentState.CONSTRUCTOR: + return new GetCurrentState(input); + case GetDatabaseStatistics.CONSTRUCTOR: + return new GetDatabaseStatistics(input); + case GetDeepLinkInfo.CONSTRUCTOR: + return new GetDeepLinkInfo(input); + case GetEmojiSuggestionsUrl.CONSTRUCTOR: + return new GetEmojiSuggestionsUrl(input); + case GetFavoriteStickers.CONSTRUCTOR: + return new GetFavoriteStickers(input); + case GetFile.CONSTRUCTOR: + return new GetFile(input); + case GetFileDownloadedPrefixSize.CONSTRUCTOR: + return new GetFileDownloadedPrefixSize(input); + case GetFileExtension.CONSTRUCTOR: + return new GetFileExtension(input); + case GetFileMimeType.CONSTRUCTOR: + return new GetFileMimeType(input); + case GetGameHighScores.CONSTRUCTOR: + return new GetGameHighScores(input); + case GetGroupsInCommon.CONSTRUCTOR: + return new GetGroupsInCommon(input); + case GetImportedContactCount.CONSTRUCTOR: + return new GetImportedContactCount(input); + case GetInactiveSupergroupChats.CONSTRUCTOR: + return new GetInactiveSupergroupChats(input); + case GetInlineGameHighScores.CONSTRUCTOR: + return new GetInlineGameHighScores(input); + case GetInlineQueryResults.CONSTRUCTOR: + return new GetInlineQueryResults(input); + case GetInstalledStickerSets.CONSTRUCTOR: + return new GetInstalledStickerSets(input); + case GetInviteText.CONSTRUCTOR: + return new GetInviteText(input); + case GetJsonString.CONSTRUCTOR: + return new GetJsonString(input); + case GetJsonValue.CONSTRUCTOR: + return new GetJsonValue(input); + case GetLanguagePackInfo.CONSTRUCTOR: + return new GetLanguagePackInfo(input); + case GetLanguagePackString.CONSTRUCTOR: + return new GetLanguagePackString(input); + case GetLanguagePackStrings.CONSTRUCTOR: + return new GetLanguagePackStrings(input); + case GetLocalizationTargetInfo.CONSTRUCTOR: + return new GetLocalizationTargetInfo(input); + case GetLogStream.CONSTRUCTOR: + return new GetLogStream(input); + case GetLogTagVerbosityLevel.CONSTRUCTOR: + return new GetLogTagVerbosityLevel(input); + case GetLogTags.CONSTRUCTOR: + return new GetLogTags(input); + case GetLogVerbosityLevel.CONSTRUCTOR: + return new GetLogVerbosityLevel(input); + case GetLoginUrl.CONSTRUCTOR: + return new GetLoginUrl(input); + case GetLoginUrlInfo.CONSTRUCTOR: + return new GetLoginUrlInfo(input); + case GetMapThumbnailFile.CONSTRUCTOR: + return new GetMapThumbnailFile(input); + case GetMarkdownText.CONSTRUCTOR: + return new GetMarkdownText(input); + case GetMe.CONSTRUCTOR: + return new GetMe(input); + case GetMessage.CONSTRUCTOR: + return new GetMessage(input); + case GetMessageLink.CONSTRUCTOR: + return new GetMessageLink(input); + case GetMessageLinkInfo.CONSTRUCTOR: + return new GetMessageLinkInfo(input); + case GetMessageLocally.CONSTRUCTOR: + return new GetMessageLocally(input); + case GetMessages.CONSTRUCTOR: + return new GetMessages(input); + case GetNetworkStatistics.CONSTRUCTOR: + return new GetNetworkStatistics(input); + case GetOption.CONSTRUCTOR: + return new GetOption(input); + case GetPassportAuthorizationForm.CONSTRUCTOR: + return new GetPassportAuthorizationForm(input); + case GetPassportAuthorizationFormAvailableElements.CONSTRUCTOR: + return new GetPassportAuthorizationFormAvailableElements(input); + case GetPassportElement.CONSTRUCTOR: + return new GetPassportElement(input); + case GetPasswordState.CONSTRUCTOR: + return new GetPasswordState(input); + case GetPaymentForm.CONSTRUCTOR: + return new GetPaymentForm(input); + case GetPaymentReceipt.CONSTRUCTOR: + return new GetPaymentReceipt(input); + case GetPollVoters.CONSTRUCTOR: + return new GetPollVoters(input); + case GetPreferredCountryLanguage.CONSTRUCTOR: + return new GetPreferredCountryLanguage(input); + case GetProxies.CONSTRUCTOR: + return new GetProxies(input); + case GetProxyLink.CONSTRUCTOR: + return new GetProxyLink(input); + case GetPublicMessageLink.CONSTRUCTOR: + return new GetPublicMessageLink(input); + case GetPushReceiverId.CONSTRUCTOR: + return new GetPushReceiverId(input); + case GetRecentInlineBots.CONSTRUCTOR: + return new GetRecentInlineBots(input); + case GetRecentStickers.CONSTRUCTOR: + return new GetRecentStickers(input); + case GetRecentlyVisitedTMeUrls.CONSTRUCTOR: + return new GetRecentlyVisitedTMeUrls(input); + case GetRecoveryEmailAddress.CONSTRUCTOR: + return new GetRecoveryEmailAddress(input); + case GetRemoteFile.CONSTRUCTOR: + return new GetRemoteFile(input); + case GetRepliedMessage.CONSTRUCTOR: + return new GetRepliedMessage(input); + case GetSavedAnimations.CONSTRUCTOR: + return new GetSavedAnimations(input); + case GetSavedOrderInfo.CONSTRUCTOR: + return new GetSavedOrderInfo(input); + case GetScopeNotificationSettings.CONSTRUCTOR: + return new GetScopeNotificationSettings(input); + case GetSecretChat.CONSTRUCTOR: + return new GetSecretChat(input); + case GetStickerEmojis.CONSTRUCTOR: + return new GetStickerEmojis(input); + case GetStickerSet.CONSTRUCTOR: + return new GetStickerSet(input); + case GetStickers.CONSTRUCTOR: + return new GetStickers(input); + case GetStorageStatistics.CONSTRUCTOR: + return new GetStorageStatistics(input); + case GetStorageStatisticsFast.CONSTRUCTOR: + return new GetStorageStatisticsFast(input); + case GetSuitableDiscussionChats.CONSTRUCTOR: + return new GetSuitableDiscussionChats(input); + case GetSupergroup.CONSTRUCTOR: + return new GetSupergroup(input); + case GetSupergroupFullInfo.CONSTRUCTOR: + return new GetSupergroupFullInfo(input); + case GetSupergroupMembers.CONSTRUCTOR: + return new GetSupergroupMembers(input); + case GetSupportUser.CONSTRUCTOR: + return new GetSupportUser(input); + case GetTemporaryPasswordState.CONSTRUCTOR: + return new GetTemporaryPasswordState(input); + case GetTextEntities.CONSTRUCTOR: + return new GetTextEntities(input); + case GetTopChats.CONSTRUCTOR: + return new GetTopChats(input); + case GetTrendingStickerSets.CONSTRUCTOR: + return new GetTrendingStickerSets(input); + case GetUser.CONSTRUCTOR: + return new GetUser(input); + case GetUserFullInfo.CONSTRUCTOR: + return new GetUserFullInfo(input); + case GetUserPrivacySettingRules.CONSTRUCTOR: + return new GetUserPrivacySettingRules(input); + case GetUserProfilePhotos.CONSTRUCTOR: + return new GetUserProfilePhotos(input); + case GetWebPageInstantView.CONSTRUCTOR: + return new GetWebPageInstantView(input); + case GetWebPagePreview.CONSTRUCTOR: + return new GetWebPagePreview(input); + case ImportContacts.CONSTRUCTOR: + return new ImportContacts(input); + case JoinChat.CONSTRUCTOR: + return new JoinChat(input); + case JoinChatByInviteLink.CONSTRUCTOR: + return new JoinChatByInviteLink(input); + case LeaveChat.CONSTRUCTOR: + return new LeaveChat(input); + case LogOut.CONSTRUCTOR: + return new LogOut(input); + case OpenChat.CONSTRUCTOR: + return new OpenChat(input); + case OpenMessageContent.CONSTRUCTOR: + return new OpenMessageContent(input); + case OptimizeStorage.CONSTRUCTOR: + return new OptimizeStorage(input); + case ParseMarkdown.CONSTRUCTOR: + return new ParseMarkdown(input); + case ParseTextEntities.CONSTRUCTOR: + return new ParseTextEntities(input); + case PinChatMessage.CONSTRUCTOR: + return new PinChatMessage(input); + case PingProxy.CONSTRUCTOR: + return new PingProxy(input); + case ProcessPushNotification.CONSTRUCTOR: + return new ProcessPushNotification(input); + case ReadAllChatMentions.CONSTRUCTOR: + return new ReadAllChatMentions(input); + case ReadFilePart.CONSTRUCTOR: + return new ReadFilePart(input); + case RecoverAuthenticationPassword.CONSTRUCTOR: + return new RecoverAuthenticationPassword(input); + case RecoverPassword.CONSTRUCTOR: + return new RecoverPassword(input); + case RegisterDevice.CONSTRUCTOR: + return new RegisterDevice(input); + case RegisterUser.CONSTRUCTOR: + return new RegisterUser(input); + case RemoveBackground.CONSTRUCTOR: + return new RemoveBackground(input); + case RemoveChatActionBar.CONSTRUCTOR: + return new RemoveChatActionBar(input); + case RemoveContacts.CONSTRUCTOR: + return new RemoveContacts(input); + case RemoveFavoriteSticker.CONSTRUCTOR: + return new RemoveFavoriteSticker(input); + case RemoveNotification.CONSTRUCTOR: + return new RemoveNotification(input); + case RemoveNotificationGroup.CONSTRUCTOR: + return new RemoveNotificationGroup(input); + case RemoveProxy.CONSTRUCTOR: + return new RemoveProxy(input); + case RemoveRecentHashtag.CONSTRUCTOR: + return new RemoveRecentHashtag(input); + case RemoveRecentSticker.CONSTRUCTOR: + return new RemoveRecentSticker(input); + case RemoveRecentlyFoundChat.CONSTRUCTOR: + return new RemoveRecentlyFoundChat(input); + case RemoveSavedAnimation.CONSTRUCTOR: + return new RemoveSavedAnimation(input); + case RemoveStickerFromSet.CONSTRUCTOR: + return new RemoveStickerFromSet(input); + case RemoveTopChat.CONSTRUCTOR: + return new RemoveTopChat(input); + case ReorderInstalledStickerSets.CONSTRUCTOR: + return new ReorderInstalledStickerSets(input); + case ReportChat.CONSTRUCTOR: + return new ReportChat(input); + case ReportSupergroupSpam.CONSTRUCTOR: + return new ReportSupergroupSpam(input); + case RequestAuthenticationPasswordRecovery.CONSTRUCTOR: + return new RequestAuthenticationPasswordRecovery(input); + case RequestPasswordRecovery.CONSTRUCTOR: + return new RequestPasswordRecovery(input); + case RequestQrCodeAuthentication.CONSTRUCTOR: + return new RequestQrCodeAuthentication(input); + case ResendAuthenticationCode.CONSTRUCTOR: + return new ResendAuthenticationCode(input); + case ResendChangePhoneNumberCode.CONSTRUCTOR: + return new ResendChangePhoneNumberCode(input); + case ResendEmailAddressVerificationCode.CONSTRUCTOR: + return new ResendEmailAddressVerificationCode(input); + case ResendMessages.CONSTRUCTOR: + return new ResendMessages(input); + case ResendPhoneNumberConfirmationCode.CONSTRUCTOR: + return new ResendPhoneNumberConfirmationCode(input); + case ResendPhoneNumberVerificationCode.CONSTRUCTOR: + return new ResendPhoneNumberVerificationCode(input); + case ResendRecoveryEmailAddressCode.CONSTRUCTOR: + return new ResendRecoveryEmailAddressCode(input); + case ResetAllNotificationSettings.CONSTRUCTOR: + return new ResetAllNotificationSettings(input); + case ResetBackgrounds.CONSTRUCTOR: + return new ResetBackgrounds(input); + case ResetNetworkStatistics.CONSTRUCTOR: + return new ResetNetworkStatistics(input); + case SaveApplicationLogEvent.CONSTRUCTOR: + return new SaveApplicationLogEvent(input); + case SearchBackground.CONSTRUCTOR: + return new SearchBackground(input); + case SearchCallMessages.CONSTRUCTOR: + return new SearchCallMessages(input); + case SearchChatMembers.CONSTRUCTOR: + return new SearchChatMembers(input); + case SearchChatMessages.CONSTRUCTOR: + return new SearchChatMessages(input); + case SearchChatRecentLocationMessages.CONSTRUCTOR: + return new SearchChatRecentLocationMessages(input); + case SearchChats.CONSTRUCTOR: + return new SearchChats(input); + case SearchChatsNearby.CONSTRUCTOR: + return new SearchChatsNearby(input); + case SearchChatsOnServer.CONSTRUCTOR: + return new SearchChatsOnServer(input); + case SearchContacts.CONSTRUCTOR: + return new SearchContacts(input); + case SearchEmojis.CONSTRUCTOR: + return new SearchEmojis(input); + case SearchHashtags.CONSTRUCTOR: + return new SearchHashtags(input); + case SearchInstalledStickerSets.CONSTRUCTOR: + return new SearchInstalledStickerSets(input); + case SearchMessages.CONSTRUCTOR: + return new SearchMessages(input); + case SearchPublicChat.CONSTRUCTOR: + return new SearchPublicChat(input); + case SearchPublicChats.CONSTRUCTOR: + return new SearchPublicChats(input); + case SearchSecretMessages.CONSTRUCTOR: + return new SearchSecretMessages(input); + case SearchStickerSet.CONSTRUCTOR: + return new SearchStickerSet(input); + case SearchStickerSets.CONSTRUCTOR: + return new SearchStickerSets(input); + case SearchStickers.CONSTRUCTOR: + return new SearchStickers(input); + case SendBotStartMessage.CONSTRUCTOR: + return new SendBotStartMessage(input); + case SendCallDebugInformation.CONSTRUCTOR: + return new SendCallDebugInformation(input); + case SendCallRating.CONSTRUCTOR: + return new SendCallRating(input); + case SendChatAction.CONSTRUCTOR: + return new SendChatAction(input); + case SendChatScreenshotTakenNotification.CONSTRUCTOR: + return new SendChatScreenshotTakenNotification(input); + case SendChatSetTtlMessage.CONSTRUCTOR: + return new SendChatSetTtlMessage(input); + case SendCustomRequest.CONSTRUCTOR: + return new SendCustomRequest(input); + case SendEmailAddressVerificationCode.CONSTRUCTOR: + return new SendEmailAddressVerificationCode(input); + case SendInlineQueryResultMessage.CONSTRUCTOR: + return new SendInlineQueryResultMessage(input); + case SendMessage.CONSTRUCTOR: + return new SendMessage(input); + case SendMessageAlbum.CONSTRUCTOR: + return new SendMessageAlbum(input); + case SendPassportAuthorizationForm.CONSTRUCTOR: + return new SendPassportAuthorizationForm(input); + case SendPaymentForm.CONSTRUCTOR: + return new SendPaymentForm(input); + case SendPhoneNumberConfirmationCode.CONSTRUCTOR: + return new SendPhoneNumberConfirmationCode(input); + case SendPhoneNumberVerificationCode.CONSTRUCTOR: + return new SendPhoneNumberVerificationCode(input); + case SetAccountTtl.CONSTRUCTOR: + return new SetAccountTtl(input); + case SetAlarm.CONSTRUCTOR: + return new SetAlarm(input); + case SetAuthenticationPhoneNumber.CONSTRUCTOR: + return new SetAuthenticationPhoneNumber(input); + case SetAutoDownloadSettings.CONSTRUCTOR: + return new SetAutoDownloadSettings(input); + case SetBackground.CONSTRUCTOR: + return new SetBackground(input); + case SetBio.CONSTRUCTOR: + return new SetBio(input); + case SetBotUpdatesStatus.CONSTRUCTOR: + return new SetBotUpdatesStatus(input); + case SetChatChatList.CONSTRUCTOR: + return new SetChatChatList(input); + case SetChatClientData.CONSTRUCTOR: + return new SetChatClientData(input); + case SetChatDescription.CONSTRUCTOR: + return new SetChatDescription(input); + case SetChatDiscussionGroup.CONSTRUCTOR: + return new SetChatDiscussionGroup(input); + case SetChatDraftMessage.CONSTRUCTOR: + return new SetChatDraftMessage(input); + case SetChatLocation.CONSTRUCTOR: + return new SetChatLocation(input); + case SetChatMemberStatus.CONSTRUCTOR: + return new SetChatMemberStatus(input); + case SetChatNotificationSettings.CONSTRUCTOR: + return new SetChatNotificationSettings(input); + case SetChatPermissions.CONSTRUCTOR: + return new SetChatPermissions(input); + case SetChatPhoto.CONSTRUCTOR: + return new SetChatPhoto(input); + case SetChatSlowModeDelay.CONSTRUCTOR: + return new SetChatSlowModeDelay(input); + case SetChatTitle.CONSTRUCTOR: + return new SetChatTitle(input); + case SetCommands.CONSTRUCTOR: + return new SetCommands(input); + case SetCustomLanguagePack.CONSTRUCTOR: + return new SetCustomLanguagePack(input); + case SetCustomLanguagePackString.CONSTRUCTOR: + return new SetCustomLanguagePackString(input); + case SetDatabaseEncryptionKey.CONSTRUCTOR: + return new SetDatabaseEncryptionKey(input); + case SetFileGenerationProgress.CONSTRUCTOR: + return new SetFileGenerationProgress(input); + case SetGameScore.CONSTRUCTOR: + return new SetGameScore(input); + case SetInlineGameScore.CONSTRUCTOR: + return new SetInlineGameScore(input); + case SetLocation.CONSTRUCTOR: + return new SetLocation(input); + case SetLogStream.CONSTRUCTOR: + return new SetLogStream(input); + case SetLogTagVerbosityLevel.CONSTRUCTOR: + return new SetLogTagVerbosityLevel(input); + case SetLogVerbosityLevel.CONSTRUCTOR: + return new SetLogVerbosityLevel(input); + case SetName.CONSTRUCTOR: + return new SetName(input); + case SetNetworkType.CONSTRUCTOR: + return new SetNetworkType(input); + case SetOption.CONSTRUCTOR: + return new SetOption(input); + case SetPassportElement.CONSTRUCTOR: + return new SetPassportElement(input); + case SetPassportElementErrors.CONSTRUCTOR: + return new SetPassportElementErrors(input); + case SetPassword.CONSTRUCTOR: + return new SetPassword(input); + case SetPinnedChats.CONSTRUCTOR: + return new SetPinnedChats(input); + case SetPollAnswer.CONSTRUCTOR: + return new SetPollAnswer(input); + case SetProfilePhoto.CONSTRUCTOR: + return new SetProfilePhoto(input); + case SetRecoveryEmailAddress.CONSTRUCTOR: + return new SetRecoveryEmailAddress(input); + case SetScopeNotificationSettings.CONSTRUCTOR: + return new SetScopeNotificationSettings(input); + case SetStickerPositionInSet.CONSTRUCTOR: + return new SetStickerPositionInSet(input); + case SetStickerSetThumbnail.CONSTRUCTOR: + return new SetStickerSetThumbnail(input); + case SetSupergroupStickerSet.CONSTRUCTOR: + return new SetSupergroupStickerSet(input); + case SetSupergroupUsername.CONSTRUCTOR: + return new SetSupergroupUsername(input); + case SetTdlibParameters.CONSTRUCTOR: + return new SetTdlibParameters(input); + case SetUserPrivacySettingRules.CONSTRUCTOR: + return new SetUserPrivacySettingRules(input); + case SetUsername.CONSTRUCTOR: + return new SetUsername(input); + case SharePhoneNumber.CONSTRUCTOR: + return new SharePhoneNumber(input); + case StopPoll.CONSTRUCTOR: + return new StopPoll(input); + case SynchronizeLanguagePack.CONSTRUCTOR: + return new SynchronizeLanguagePack(input); + case TerminateAllOtherSessions.CONSTRUCTOR: + return new TerminateAllOtherSessions(input); + case TerminateSession.CONSTRUCTOR: + return new TerminateSession(input); + case TestCallBytes.CONSTRUCTOR: + return new TestCallBytes(input); + case TestCallEmpty.CONSTRUCTOR: + return new TestCallEmpty(input); + case TestCallString.CONSTRUCTOR: + return new TestCallString(input); + case TestCallVectorInt.CONSTRUCTOR: + return new TestCallVectorInt(input); + case TestCallVectorIntObject.CONSTRUCTOR: + return new TestCallVectorIntObject(input); + case TestCallVectorString.CONSTRUCTOR: + return new TestCallVectorString(input); + case TestCallVectorStringObject.CONSTRUCTOR: + return new TestCallVectorStringObject(input); + case TestGetDifference.CONSTRUCTOR: + return new TestGetDifference(input); + case TestNetwork.CONSTRUCTOR: + return new TestNetwork(input); + case TestProxy.CONSTRUCTOR: + return new TestProxy(input); + case TestReturnError.CONSTRUCTOR: + return new TestReturnError(input); + case TestSquareInt.CONSTRUCTOR: + return new TestSquareInt(input); + case TestUseUpdate.CONSTRUCTOR: + return new TestUseUpdate(input); + case ToggleChatDefaultDisableNotification.CONSTRUCTOR: + return new ToggleChatDefaultDisableNotification(input); + case ToggleChatIsMarkedAsUnread.CONSTRUCTOR: + return new ToggleChatIsMarkedAsUnread(input); + case ToggleChatIsPinned.CONSTRUCTOR: + return new ToggleChatIsPinned(input); + case ToggleSupergroupIsAllHistoryAvailable.CONSTRUCTOR: + return new ToggleSupergroupIsAllHistoryAvailable(input); + case ToggleSupergroupSignMessages.CONSTRUCTOR: + return new ToggleSupergroupSignMessages(input); + case TransferChatOwnership.CONSTRUCTOR: + return new TransferChatOwnership(input); + case UnblockUser.CONSTRUCTOR: + return new UnblockUser(input); + case UnpinChatMessage.CONSTRUCTOR: + return new UnpinChatMessage(input); + case UpgradeBasicGroupChatToSupergroupChat.CONSTRUCTOR: + return new UpgradeBasicGroupChatToSupergroupChat(input); + case UploadFile.CONSTRUCTOR: + return new UploadFile(input); + case UploadStickerFile.CONSTRUCTOR: + return new UploadStickerFile(input); + case ValidateOrderInfo.CONSTRUCTOR: + return new ValidateOrderInfo(input); + case ViewMessages.CONSTRUCTOR: + return new ViewMessages(input); + case ViewTrendingStickerSets.CONSTRUCTOR: + return new ViewTrendingStickerSets(input); + case WriteGeneratedFilePart.CONSTRUCTOR: + return new WriteGeneratedFilePart(input); + default: + throw new UnsupportedOperationException(); + } + } + } + + public abstract static class AuthenticationCodeType extends Object {} + + public abstract static class AuthorizationState extends Object {} + + public abstract static class BackgroundFill extends Object {} + + public abstract static class BackgroundType extends Object {} + + public abstract static class CallDiscardReason extends Object {} + + public abstract static class CallProblem extends Object {} + + public abstract static class CallState extends Object {} + + public abstract static class CallbackQueryPayload extends Object {} + + public abstract static class CanTransferOwnershipResult extends Object {} + + public abstract static class ChatAction extends Object {} + + public abstract static class ChatActionBar extends Object {} + + public abstract static class ChatEventAction extends Object {} + + public abstract static class ChatList extends Object {} + + public abstract static class ChatMemberStatus extends Object {} + + public abstract static class ChatMembersFilter extends Object {} + + public abstract static class ChatReportReason extends Object {} + + public abstract static class ChatType extends Object {} + + public abstract static class CheckChatUsernameResult extends Object {} + + public abstract static class ConnectionState extends Object {} + + public abstract static class DeviceToken extends Object {} + + public abstract static class FileType extends Object {} + + public abstract static class InlineKeyboardButtonType extends Object {} + + public abstract static class InlineQueryResult extends Object {} + + public abstract static class InputBackground extends Object {} + + public abstract static class InputCredentials extends Object {} + + public abstract static class InputFile extends Object {} + + public abstract static class InputInlineQueryResult extends Object {} + + public abstract static class InputMessageContent extends Object {} + + public abstract static class InputPassportElement extends Object {} + + public abstract static class InputPassportElementErrorSource extends Object {} + + public abstract static class InputSticker extends Object {} + + public abstract static class JsonValue extends Object {} + + public abstract static class KeyboardButtonType extends Object {} + + public abstract static class LanguagePackStringValue extends Object {} + + public abstract static class LogStream extends Object {} + + public abstract static class LoginUrlInfo extends Object {} + + public abstract static class MaskPoint extends Object {} + + public abstract static class MessageContent extends Object {} + + public abstract static class MessageForwardOrigin extends Object {} + + public abstract static class MessageSchedulingState extends Object {} + + public abstract static class MessageSendingState extends Object {} + + public abstract static class NetworkStatisticsEntry extends Object {} + + public abstract static class NetworkType extends Object {} + + public abstract static class NotificationGroupType extends Object {} + + public abstract static class NotificationSettingsScope extends Object {} + + public abstract static class NotificationType extends Object {} + + public abstract static class OptionValue extends Object {} + + public abstract static class PageBlock extends Object {} + + public abstract static class PageBlockHorizontalAlignment extends Object {} + + public abstract static class PageBlockVerticalAlignment extends Object {} + + public abstract static class PassportElement extends Object {} + + public abstract static class PassportElementErrorSource extends Object {} + + public abstract static class PassportElementType extends Object {} + + public abstract static class PollType extends Object {} + + public abstract static class ProxyType extends Object {} + + public abstract static class PublicChatType extends Object {} + + public abstract static class PushMessageContent extends Object {} + + public abstract static class ReplyMarkup extends Object {} + + public abstract static class RichText extends Object {} + + public abstract static class SearchMessagesFilter extends Object {} + + public abstract static class SecretChatState extends Object {} + + public abstract static class StatisticsGraph extends Object {} + + public abstract static class SupergroupMembersFilter extends Object {} + + public abstract static class TMeUrlType extends Object {} + + public abstract static class TextEntityType extends Object {} + + public abstract static class TextParseMode extends Object {} + + public abstract static class TopChatCategory extends Object {} + + public abstract static class Update extends Object {} + + public abstract static class UserPrivacySetting extends Object {} + + public abstract static class UserPrivacySettingRule extends Object {} + + public abstract static class UserStatus extends Object {} + + public abstract static class UserType extends Object {} + public static class AccountTtl extends Object { public int days; - public AccountTtl() { - } + public static final int CONSTRUCTOR = 1324495492; + + public AccountTtl() {} public AccountTtl(int days) { this.days = days; } - public static final int CONSTRUCTOR = 1324495492; + public AccountTtl(DataInputStream input) throws IOException { + this.days = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.days); + } } public static class Address extends Object { @@ -37,8 +2524,9 @@ public class TdApi { public String streetLine2; public String postalCode; - public Address() { - } + public static final int CONSTRUCTOR = -2043654342; + + public Address() {} public Address(String countryCode, String state, String city, String streetLine1, String streetLine2, String postalCode) { this.countryCode = countryCode; @@ -49,12 +2537,94 @@ public class TdApi { this.postalCode = postalCode; } - public static final int CONSTRUCTOR = -2043654342; + public Address(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var countryCodeTmp = new byte[input.readInt()]; + input.readFully(countryCodeTmp); + this.countryCode = new String(countryCodeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var stateTmp = new byte[input.readInt()]; + input.readFully(stateTmp); + this.state = new String(stateTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var cityTmp = new byte[input.readInt()]; + input.readFully(cityTmp); + this.city = new String(cityTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var streetLine1Tmp = new byte[input.readInt()]; + input.readFully(streetLine1Tmp); + this.streetLine1 = new String(streetLine1Tmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var streetLine2Tmp = new byte[input.readInt()]; + input.readFully(streetLine2Tmp); + this.streetLine2 = new String(streetLine2Tmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var postalCodeTmp = new byte[input.readInt()]; + input.readFully(postalCodeTmp); + this.postalCode = new String(postalCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.countryCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var countryCodeTmp = this.countryCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(countryCodeTmp.length); + output.write(countryCodeTmp); + } + if (this.state == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var stateTmp = this.state.getBytes(StandardCharsets.UTF_8); + output.writeInt(stateTmp.length); + output.write(stateTmp); + } + if (this.city == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var cityTmp = this.city.getBytes(StandardCharsets.UTF_8); + output.writeInt(cityTmp.length); + output.write(cityTmp); + } + if (this.streetLine1 == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var streetLine1Tmp = this.streetLine1.getBytes(StandardCharsets.UTF_8); + output.writeInt(streetLine1Tmp.length); + output.write(streetLine1Tmp); + } + if (this.streetLine2 == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var streetLine2Tmp = this.streetLine2.getBytes(StandardCharsets.UTF_8); + output.writeInt(streetLine2Tmp.length); + output.write(streetLine2Tmp); + } + if (this.postalCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var postalCodeTmp = this.postalCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(postalCodeTmp.length); + output.write(postalCodeTmp); + } + } } public static class Animation extends Object { @@ -67,8 +2637,9 @@ public class TdApi { public PhotoSize thumbnail; public File animation; - public Animation() { - } + public static final int CONSTRUCTOR = -1629245379; + + public Animation() {} public Animation(int duration, int width, int height, String fileName, String mimeType, Minithumbnail minithumbnail, PhotoSize thumbnail, File animation) { this.duration = duration; @@ -81,30 +2652,118 @@ public class TdApi { this.animation = animation; } - public static final int CONSTRUCTOR = -1629245379; + public Animation(DataInputStream input) throws IOException { + this.duration = input.readInt(); + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + var fileNameTmp = new byte[input.readInt()]; + input.readFully(fileNameTmp); + this.fileName = new String(fileNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Minithumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.minithumbnail = new Minithumbnail(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.duration); + output.writeInt(this.width); + output.writeInt(this.height); + if (this.fileName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fileNameTmp = this.fileName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fileNameTmp.length); + output.write(fileNameTmp); + } + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + if (this.minithumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.minithumbnail.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + } } public static class Animations extends Object { public Animation[] animations; - public Animations() { - } + public static final int CONSTRUCTOR = 344216945; + + public Animations() {} public Animations(Animation[] animations) { this.animations = animations; } - public static final int CONSTRUCTOR = 344216945; + public Animations(DataInputStream input) throws IOException { + this.animations = new Animation[input.readInt()]; + for (int i = 0; i < this.animations.length; i++) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animations[i] = new Animation(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.animations.length); + for (int i = 0; i < this.animations.length; i++) { + this.animations[i].serialize(output); + } + } } public static class Audio extends Object { @@ -117,8 +2776,9 @@ public class TdApi { public PhotoSize albumCoverThumbnail; public File audio; - public Audio() { - } + public static final int CONSTRUCTOR = 1475294302; + + public Audio() {} public Audio(int duration, String title, String performer, String fileName, String mimeType, Minithumbnail albumCoverMinithumbnail, PhotoSize albumCoverThumbnail, File audio) { this.duration = duration; @@ -131,12 +2791,106 @@ public class TdApi { this.audio = audio; } - public static final int CONSTRUCTOR = 1475294302; + public Audio(DataInputStream input) throws IOException { + this.duration = input.readInt(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var performerTmp = new byte[input.readInt()]; + input.readFully(performerTmp); + this.performer = new String(performerTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var fileNameTmp = new byte[input.readInt()]; + input.readFully(fileNameTmp); + this.fileName = new String(fileNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Minithumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.albumCoverMinithumbnail = new Minithumbnail(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.albumCoverThumbnail = new PhotoSize(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.audio = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.duration); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.performer == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var performerTmp = this.performer.getBytes(StandardCharsets.UTF_8); + output.writeInt(performerTmp.length); + output.write(performerTmp); + } + if (this.fileName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fileNameTmp = this.fileName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fileNameTmp.length); + output.write(fileNameTmp); + } + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + if (this.albumCoverMinithumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.albumCoverMinithumbnail.serialize(output); + } + if (this.albumCoverThumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.albumCoverThumbnail.serialize(output); + } + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + } } public static class AuthenticationCodeInfo extends Object { @@ -145,8 +2899,9 @@ public class TdApi { public AuthenticationCodeType nextType; public int timeout; - public AuthenticationCodeInfo() { - } + public static final int CONSTRUCTOR = -860345416; + + public AuthenticationCodeInfo() {} public AuthenticationCodeInfo(String phoneNumber, AuthenticationCodeType type, AuthenticationCodeType nextType, int timeout) { this.phoneNumber = phoneNumber; @@ -155,188 +2910,357 @@ public class TdApi { this.timeout = timeout; } - public static final int CONSTRUCTOR = -860345416; + public AuthenticationCodeInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case AuthenticationCodeTypeTelegramMessage.CONSTRUCTOR: + this.type = new AuthenticationCodeTypeTelegramMessage(input); + break; + case AuthenticationCodeTypeSms.CONSTRUCTOR: + this.type = new AuthenticationCodeTypeSms(input); + break; + case AuthenticationCodeTypeCall.CONSTRUCTOR: + this.type = new AuthenticationCodeTypeCall(input); + break; + case AuthenticationCodeTypeFlashCall.CONSTRUCTOR: + this.type = new AuthenticationCodeTypeFlashCall(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case AuthenticationCodeTypeTelegramMessage.CONSTRUCTOR: + this.nextType = new AuthenticationCodeTypeTelegramMessage(input); + break; + case AuthenticationCodeTypeSms.CONSTRUCTOR: + this.nextType = new AuthenticationCodeTypeSms(input); + break; + case AuthenticationCodeTypeCall.CONSTRUCTOR: + this.nextType = new AuthenticationCodeTypeCall(input); + break; + case AuthenticationCodeTypeFlashCall.CONSTRUCTOR: + this.nextType = new AuthenticationCodeTypeFlashCall(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.timeout = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class AuthenticationCodeType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.nextType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.nextType.serialize(output); + } + output.writeInt(this.timeout); + } } public static class AuthenticationCodeTypeTelegramMessage extends AuthenticationCodeType { public int length; - public AuthenticationCodeTypeTelegramMessage() { - } + public static final int CONSTRUCTOR = 2079628074; + + public AuthenticationCodeTypeTelegramMessage() {} public AuthenticationCodeTypeTelegramMessage(int length) { this.length = length; } - public static final int CONSTRUCTOR = 2079628074; + public AuthenticationCodeTypeTelegramMessage(DataInputStream input) throws IOException { + this.length = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.length); + } } public static class AuthenticationCodeTypeSms extends AuthenticationCodeType { public int length; - public AuthenticationCodeTypeSms() { - } + public static final int CONSTRUCTOR = 962650760; + + public AuthenticationCodeTypeSms() {} public AuthenticationCodeTypeSms(int length) { this.length = length; } - public static final int CONSTRUCTOR = 962650760; + public AuthenticationCodeTypeSms(DataInputStream input) throws IOException { + this.length = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.length); + } } public static class AuthenticationCodeTypeCall extends AuthenticationCodeType { public int length; - public AuthenticationCodeTypeCall() { - } + public static final int CONSTRUCTOR = 1636265063; + + public AuthenticationCodeTypeCall() {} public AuthenticationCodeTypeCall(int length) { this.length = length; } - public static final int CONSTRUCTOR = 1636265063; + public AuthenticationCodeTypeCall(DataInputStream input) throws IOException { + this.length = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.length); + } } public static class AuthenticationCodeTypeFlashCall extends AuthenticationCodeType { public String pattern; - public AuthenticationCodeTypeFlashCall() { - } + public static final int CONSTRUCTOR = 1395882402; + + public AuthenticationCodeTypeFlashCall() {} public AuthenticationCodeTypeFlashCall(String pattern) { this.pattern = pattern; } - public static final int CONSTRUCTOR = 1395882402; + public AuthenticationCodeTypeFlashCall(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var patternTmp = new byte[input.readInt()]; + input.readFully(patternTmp); + this.pattern = new String(patternTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class AuthorizationState extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.pattern == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var patternTmp = this.pattern.getBytes(StandardCharsets.UTF_8); + output.writeInt(patternTmp.length); + output.write(patternTmp); + } + } } public static class AuthorizationStateWaitTdlibParameters extends AuthorizationState { - - public AuthorizationStateWaitTdlibParameters() { - } - public static final int CONSTRUCTOR = 904720988; - @Override + public AuthorizationStateWaitTdlibParameters() {} + + + public AuthorizationStateWaitTdlibParameters(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class AuthorizationStateWaitEncryptionKey extends AuthorizationState { public boolean isEncrypted; - public AuthorizationStateWaitEncryptionKey() { - } + public static final int CONSTRUCTOR = 612103496; + + public AuthorizationStateWaitEncryptionKey() {} public AuthorizationStateWaitEncryptionKey(boolean isEncrypted) { this.isEncrypted = isEncrypted; } - public static final int CONSTRUCTOR = 612103496; + public AuthorizationStateWaitEncryptionKey(DataInputStream input) throws IOException { + this.isEncrypted = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isEncrypted); + } } public static class AuthorizationStateWaitPhoneNumber extends AuthorizationState { - - public AuthorizationStateWaitPhoneNumber() { - } - public static final int CONSTRUCTOR = 306402531; - @Override + public AuthorizationStateWaitPhoneNumber() {} + + + public AuthorizationStateWaitPhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class AuthorizationStateWaitCode extends AuthorizationState { public AuthenticationCodeInfo codeInfo; - public AuthorizationStateWaitCode() { - } + public static final int CONSTRUCTOR = 52643073; + + public AuthorizationStateWaitCode() {} public AuthorizationStateWaitCode(AuthenticationCodeInfo codeInfo) { this.codeInfo = codeInfo; } - public static final int CONSTRUCTOR = 52643073; + public AuthorizationStateWaitCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (AuthenticationCodeInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.codeInfo = new AuthenticationCodeInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.codeInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.codeInfo.serialize(output); + } + } } public static class AuthorizationStateWaitOtherDeviceConfirmation extends AuthorizationState { public String link; - public AuthorizationStateWaitOtherDeviceConfirmation() { - } + public static final int CONSTRUCTOR = 860166378; + + public AuthorizationStateWaitOtherDeviceConfirmation() {} public AuthorizationStateWaitOtherDeviceConfirmation(String link) { this.link = link; } - public static final int CONSTRUCTOR = 860166378; + public AuthorizationStateWaitOtherDeviceConfirmation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var linkTmp = new byte[input.readInt()]; + input.readFully(linkTmp); + this.link = new String(linkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.link == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var linkTmp = this.link.getBytes(StandardCharsets.UTF_8); + output.writeInt(linkTmp.length); + output.write(linkTmp); + } + } } public static class AuthorizationStateWaitRegistration extends AuthorizationState { public TermsOfService termsOfService; - public AuthorizationStateWaitRegistration() { - } + public static final int CONSTRUCTOR = 550350511; + + public AuthorizationStateWaitRegistration() {} public AuthorizationStateWaitRegistration(TermsOfService termsOfService) { this.termsOfService = termsOfService; } - public static final int CONSTRUCTOR = 550350511; + public AuthorizationStateWaitRegistration(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (TermsOfService.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.termsOfService = new TermsOfService(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.termsOfService == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.termsOfService.serialize(output); + } + } } public static class AuthorizationStateWaitPassword extends AuthorizationState { @@ -344,8 +3268,9 @@ public class TdApi { public boolean hasRecoveryEmailAddress; public String recoveryEmailAddressPattern; - public AuthorizationStateWaitPassword() { - } + public static final int CONSTRUCTOR = 187548796; + + public AuthorizationStateWaitPassword() {} public AuthorizationStateWaitPassword(String passwordHint, boolean hasRecoveryEmailAddress, String recoveryEmailAddressPattern) { this.passwordHint = passwordHint; @@ -353,64 +3278,116 @@ public class TdApi { this.recoveryEmailAddressPattern = recoveryEmailAddressPattern; } - public static final int CONSTRUCTOR = 187548796; + public AuthorizationStateWaitPassword(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var passwordHintTmp = new byte[input.readInt()]; + input.readFully(passwordHintTmp); + this.passwordHint = new String(passwordHintTmp, StandardCharsets.UTF_8); + } + this.hasRecoveryEmailAddress = input.readBoolean(); + if (input.readBoolean()) { + var recoveryEmailAddressPatternTmp = new byte[input.readInt()]; + input.readFully(recoveryEmailAddressPatternTmp); + this.recoveryEmailAddressPattern = new String(recoveryEmailAddressPatternTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.passwordHint == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordHintTmp = this.passwordHint.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordHintTmp.length); + output.write(passwordHintTmp); + } + output.writeBoolean(this.hasRecoveryEmailAddress); + if (this.recoveryEmailAddressPattern == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var recoveryEmailAddressPatternTmp = this.recoveryEmailAddressPattern.getBytes(StandardCharsets.UTF_8); + output.writeInt(recoveryEmailAddressPatternTmp.length); + output.write(recoveryEmailAddressPatternTmp); + } + } } public static class AuthorizationStateReady extends AuthorizationState { - - public AuthorizationStateReady() { - } - public static final int CONSTRUCTOR = -1834871737; - @Override + public AuthorizationStateReady() {} + + + public AuthorizationStateReady(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class AuthorizationStateLoggingOut extends AuthorizationState { - - public AuthorizationStateLoggingOut() { - } - public static final int CONSTRUCTOR = 154449270; - @Override + public AuthorizationStateLoggingOut() {} + + + public AuthorizationStateLoggingOut(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class AuthorizationStateClosing extends AuthorizationState { - - public AuthorizationStateClosing() { - } - public static final int CONSTRUCTOR = 445855311; - @Override + public AuthorizationStateClosing() {} + + + public AuthorizationStateClosing(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class AuthorizationStateClosed extends AuthorizationState { - - public AuthorizationStateClosed() { - } - public static final int CONSTRUCTOR = 1526047584; - @Override + public AuthorizationStateClosed() {} + + + public AuthorizationStateClosed(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class AutoDownloadSettings extends Object { @@ -423,8 +3400,9 @@ public class TdApi { public boolean preloadNextAudio; public boolean useLessDataForCalls; - public AutoDownloadSettings() { - } + public static final int CONSTRUCTOR = -2144418333; + + public AutoDownloadSettings() {} public AutoDownloadSettings(boolean isAutoDownloadEnabled, int maxPhotoFileSize, int maxVideoFileSize, int maxOtherFileSize, int videoUploadBitrate, boolean preloadLargeVideos, boolean preloadNextAudio, boolean useLessDataForCalls) { this.isAutoDownloadEnabled = isAutoDownloadEnabled; @@ -437,12 +3415,32 @@ public class TdApi { this.useLessDataForCalls = useLessDataForCalls; } - public static final int CONSTRUCTOR = -2144418333; + public AutoDownloadSettings(DataInputStream input) throws IOException { + this.isAutoDownloadEnabled = input.readBoolean(); + this.maxPhotoFileSize = input.readInt(); + this.maxVideoFileSize = input.readInt(); + this.maxOtherFileSize = input.readInt(); + this.videoUploadBitrate = input.readInt(); + this.preloadLargeVideos = input.readBoolean(); + this.preloadNextAudio = input.readBoolean(); + this.useLessDataForCalls = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAutoDownloadEnabled); + output.writeInt(this.maxPhotoFileSize); + output.writeInt(this.maxVideoFileSize); + output.writeInt(this.maxOtherFileSize); + output.writeInt(this.videoUploadBitrate); + output.writeBoolean(this.preloadLargeVideos); + output.writeBoolean(this.preloadNextAudio); + output.writeBoolean(this.useLessDataForCalls); + } } public static class AutoDownloadSettingsPresets extends Object { @@ -450,8 +3448,9 @@ public class TdApi { public AutoDownloadSettings medium; public AutoDownloadSettings high; - public AutoDownloadSettingsPresets() { - } + public static final int CONSTRUCTOR = -782099166; + + public AutoDownloadSettingsPresets() {} public AutoDownloadSettingsPresets(AutoDownloadSettings low, AutoDownloadSettings medium, AutoDownloadSettings high) { this.low = low; @@ -459,12 +3458,52 @@ public class TdApi { this.high = high; } - public static final int CONSTRUCTOR = -782099166; + public AutoDownloadSettingsPresets(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (AutoDownloadSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.low = new AutoDownloadSettings(input); + } + if (input.readBoolean()) { + if (AutoDownloadSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.medium = new AutoDownloadSettings(input); + } + if (input.readBoolean()) { + if (AutoDownloadSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.high = new AutoDownloadSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.low == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.low.serialize(output); + } + if (this.medium == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.medium.serialize(output); + } + if (this.high == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.high.serialize(output); + } + } } public static class Background extends Object { @@ -475,8 +3514,9 @@ public class TdApi { public Document document; public BackgroundType type; - public Background() { - } + public static final int CONSTRUCTOR = -429971172; + + public Background() {} public Background(long id, boolean isDefault, boolean isDark, String name, Document document, BackgroundType type) { this.id = id; @@ -487,33 +3527,93 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = -429971172; + public Background(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.isDefault = input.readBoolean(); + this.isDark = input.readBoolean(); + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Document.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new Document(input); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case BackgroundTypeWallpaper.CONSTRUCTOR: + this.type = new BackgroundTypeWallpaper(input); + break; + case BackgroundTypePattern.CONSTRUCTOR: + this.type = new BackgroundTypePattern(input); + break; + case BackgroundTypeFill.CONSTRUCTOR: + this.type = new BackgroundTypeFill(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class BackgroundFill extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeBoolean(this.isDefault); + output.writeBoolean(this.isDark); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class BackgroundFillSolid extends BackgroundFill { public int color; - public BackgroundFillSolid() { - } + public static final int CONSTRUCTOR = 1010678813; + + public BackgroundFillSolid() {} public BackgroundFillSolid(int color) { this.color = color; } - public static final int CONSTRUCTOR = 1010678813; + public BackgroundFillSolid(DataInputStream input) throws IOException { + this.color = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.color); + } } public static class BackgroundFillGradient extends BackgroundFill { @@ -521,8 +3621,9 @@ public class TdApi { public int bottomColor; public int rotationAngle; - public BackgroundFillGradient() { - } + public static final int CONSTRUCTOR = -1839206017; + + public BackgroundFillGradient() {} public BackgroundFillGradient(int topColor, int bottomColor, int rotationAngle) { this.topColor = topColor; @@ -530,35 +3631,51 @@ public class TdApi { this.rotationAngle = rotationAngle; } - public static final int CONSTRUCTOR = -1839206017; + public BackgroundFillGradient(DataInputStream input) throws IOException { + this.topColor = input.readInt(); + this.bottomColor = input.readInt(); + this.rotationAngle = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class BackgroundType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.topColor); + output.writeInt(this.bottomColor); + output.writeInt(this.rotationAngle); + } } public static class BackgroundTypeWallpaper extends BackgroundType { public boolean isBlurred; public boolean isMoving; - public BackgroundTypeWallpaper() { - } + public static final int CONSTRUCTOR = 1972128891; + + public BackgroundTypeWallpaper() {} public BackgroundTypeWallpaper(boolean isBlurred, boolean isMoving) { this.isBlurred = isBlurred; this.isMoving = isMoving; } - public static final int CONSTRUCTOR = 1972128891; + public BackgroundTypeWallpaper(DataInputStream input) throws IOException { + this.isBlurred = input.readBoolean(); + this.isMoving = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isBlurred); + output.writeBoolean(this.isMoving); + } } public static class BackgroundTypePattern extends BackgroundType { @@ -566,8 +3683,9 @@ public class TdApi { public int intensity; public boolean isMoving; - public BackgroundTypePattern() { - } + public static final int CONSTRUCTOR = 649993914; + + public BackgroundTypePattern() {} public BackgroundTypePattern(BackgroundFill fill, int intensity, boolean isMoving) { this.fill = fill; @@ -575,88 +3693,213 @@ public class TdApi { this.isMoving = isMoving; } - public static final int CONSTRUCTOR = 649993914; + public BackgroundTypePattern(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case BackgroundFillSolid.CONSTRUCTOR: + this.fill = new BackgroundFillSolid(input); + break; + case BackgroundFillGradient.CONSTRUCTOR: + this.fill = new BackgroundFillGradient(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.intensity = input.readInt(); + this.isMoving = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fill == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.fill.serialize(output); + } + output.writeInt(this.intensity); + output.writeBoolean(this.isMoving); + } } public static class BackgroundTypeFill extends BackgroundType { public BackgroundFill fill; - public BackgroundTypeFill() { - } + public static final int CONSTRUCTOR = 993008684; + + public BackgroundTypeFill() {} public BackgroundTypeFill(BackgroundFill fill) { this.fill = fill; } - public static final int CONSTRUCTOR = 993008684; + public BackgroundTypeFill(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case BackgroundFillSolid.CONSTRUCTOR: + this.fill = new BackgroundFillSolid(input); + break; + case BackgroundFillGradient.CONSTRUCTOR: + this.fill = new BackgroundFillGradient(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fill == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.fill.serialize(output); + } + } } public static class Backgrounds extends Object { public Background[] backgrounds; - public Backgrounds() { - } + public static final int CONSTRUCTOR = 724728704; + + public Backgrounds() {} public Backgrounds(Background[] backgrounds) { this.backgrounds = backgrounds; } - public static final int CONSTRUCTOR = 724728704; + public Backgrounds(DataInputStream input) throws IOException { + this.backgrounds = new Background[input.readInt()]; + for (int i = 0; i < this.backgrounds.length; i++) { + if (Background.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.backgrounds[i] = new Background(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.backgrounds.length); + for (int i = 0; i < this.backgrounds.length; i++) { + this.backgrounds[i].serialize(output); + } + } } public static class BankCardActionOpenUrl extends Object { public String text; public String url; - public BankCardActionOpenUrl() { - } + public static final int CONSTRUCTOR = -196454267; + + public BankCardActionOpenUrl() {} public BankCardActionOpenUrl(String text, String url) { this.text = text; this.url = url; } - public static final int CONSTRUCTOR = -196454267; + public BankCardActionOpenUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class BankCardInfo extends Object { public String title; public BankCardActionOpenUrl[] actions; - public BankCardInfo() { - } + public static final int CONSTRUCTOR = -2116647730; + + public BankCardInfo() {} public BankCardInfo(String title, BankCardActionOpenUrl[] actions) { this.title = title; this.actions = actions; } - public static final int CONSTRUCTOR = -2116647730; + public BankCardInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.actions = new BankCardActionOpenUrl[input.readInt()]; + for (int i = 0; i < this.actions.length; i++) { + if (BankCardActionOpenUrl.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.actions[i] = new BankCardActionOpenUrl(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeInt(this.actions.length); + for (int i = 0; i < this.actions.length; i++) { + this.actions[i].serialize(output); + } + } } public static class BasicGroup extends Object { @@ -666,8 +3909,9 @@ public class TdApi { public boolean isActive; public int upgradedToSupergroupId; - public BasicGroup() { - } + public static final int CONSTRUCTOR = -317839045; + + public BasicGroup() {} public BasicGroup(int id, int memberCount, ChatMemberStatus status, boolean isActive, int upgradedToSupergroupId) { this.id = id; @@ -677,12 +3921,54 @@ public class TdApi { this.upgradedToSupergroupId = upgradedToSupergroupId; } - public static final int CONSTRUCTOR = -317839045; + public BasicGroup(DataInputStream input) throws IOException { + this.id = input.readInt(); + this.memberCount = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.status = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.status = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.status = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.status = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.status = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.status = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.isActive = input.readBoolean(); + this.upgradedToSupergroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + output.writeInt(this.memberCount); + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + output.writeBoolean(this.isActive); + output.writeInt(this.upgradedToSupergroupId); + } } public static class BasicGroupFullInfo extends Object { @@ -691,8 +3977,9 @@ public class TdApi { public ChatMember[] members; public String inviteLink; - public BasicGroupFullInfo() { - } + public static final int CONSTRUCTOR = 161500149; + + public BasicGroupFullInfo() {} public BasicGroupFullInfo(String description, int creatorUserId, ChatMember[] members, String inviteLink) { this.description = description; @@ -701,52 +3988,155 @@ public class TdApi { this.inviteLink = inviteLink; } - public static final int CONSTRUCTOR = 161500149; + public BasicGroupFullInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + this.creatorUserId = input.readInt(); + this.members = new ChatMember[input.readInt()]; + for (int i = 0; i < this.members.length; i++) { + if (ChatMember.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.members[i] = new ChatMember(input); + } + if (input.readBoolean()) { + var inviteLinkTmp = new byte[input.readInt()]; + input.readFully(inviteLinkTmp); + this.inviteLink = new String(inviteLinkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + output.writeInt(this.creatorUserId); + output.writeInt(this.members.length); + for (int i = 0; i < this.members.length; i++) { + this.members[i].serialize(output); + } + if (this.inviteLink == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inviteLinkTmp = this.inviteLink.getBytes(StandardCharsets.UTF_8); + output.writeInt(inviteLinkTmp.length); + output.write(inviteLinkTmp); + } + } } public static class BotCommand extends Object { public String command; public String description; - public BotCommand() { - } + public static final int CONSTRUCTOR = -1032140601; + + public BotCommand() {} public BotCommand(String command, String description) { this.command = command; this.description = description; } - public static final int CONSTRUCTOR = -1032140601; + public BotCommand(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var commandTmp = new byte[input.readInt()]; + input.readFully(commandTmp); + this.command = new String(commandTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.command == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var commandTmp = this.command.getBytes(StandardCharsets.UTF_8); + output.writeInt(commandTmp.length); + output.write(commandTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + } } public static class BotInfo extends Object { public String description; public BotCommand[] commands; - public BotInfo() { - } + public static final int CONSTRUCTOR = 1296528907; + + public BotInfo() {} public BotInfo(String description, BotCommand[] commands) { this.description = description; this.commands = commands; } - public static final int CONSTRUCTOR = 1296528907; + public BotInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + this.commands = new BotCommand[input.readInt()]; + for (int i = 0; i < this.commands.length; i++) { + if (BotCommand.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.commands[i] = new BotCommand(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + output.writeInt(this.commands.length); + for (int i = 0; i < this.commands.length; i++) { + this.commands[i].serialize(output); + } + } } public static class Call extends Object { @@ -755,8 +4145,9 @@ public class TdApi { public boolean isOutgoing; public CallState state; - public Call() { - } + public static final int CONSTRUCTOR = -1837599107; + + public Call() {} public Call(int id, int userId, boolean isOutgoing, CallState state) { this.id = id; @@ -765,12 +4156,52 @@ public class TdApi { this.state = state; } - public static final int CONSTRUCTOR = -1837599107; + public Call(DataInputStream input) throws IOException { + this.id = input.readInt(); + this.userId = input.readInt(); + this.isOutgoing = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case CallStatePending.CONSTRUCTOR: + this.state = new CallStatePending(input); + break; + case CallStateExchangingKeys.CONSTRUCTOR: + this.state = new CallStateExchangingKeys(input); + break; + case CallStateReady.CONSTRUCTOR: + this.state = new CallStateReady(input); + break; + case CallStateHangingUp.CONSTRUCTOR: + this.state = new CallStateHangingUp(input); + break; + case CallStateDiscarded.CONSTRUCTOR: + this.state = new CallStateDiscarded(input); + break; + case CallStateError.CONSTRUCTOR: + this.state = new CallStateError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + output.writeInt(this.userId); + output.writeBoolean(this.isOutgoing); + if (this.state == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.state.serialize(output); + } + } } public static class CallConnection extends Object { @@ -780,8 +4211,9 @@ public class TdApi { public int port; public byte[] peerTag; - public CallConnection() { - } + public static final int CONSTRUCTOR = 1318542714; + + public CallConnection() {} public CallConnection(long id, String ip, String ipv6, int port, byte[] peerTag) { this.id = id; @@ -791,192 +4223,291 @@ public class TdApi { this.peerTag = peerTag; } - public static final int CONSTRUCTOR = 1318542714; + public CallConnection(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var ipTmp = new byte[input.readInt()]; + input.readFully(ipTmp); + this.ip = new String(ipTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var ipv6Tmp = new byte[input.readInt()]; + input.readFully(ipv6Tmp); + this.ipv6 = new String(ipv6Tmp, StandardCharsets.UTF_8); + } + this.port = input.readInt(); + this.peerTag = new byte[input.readInt()]; + input.readFully(this.peerTag); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class CallDiscardReason extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.ip == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var ipTmp = this.ip.getBytes(StandardCharsets.UTF_8); + output.writeInt(ipTmp.length); + output.write(ipTmp); + } + if (this.ipv6 == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var ipv6Tmp = this.ipv6.getBytes(StandardCharsets.UTF_8); + output.writeInt(ipv6Tmp.length); + output.write(ipv6Tmp); + } + output.writeInt(this.port); + output.writeInt(this.peerTag.length); + output.write(this.peerTag); + } } public static class CallDiscardReasonEmpty extends CallDiscardReason { - - public CallDiscardReasonEmpty() { - } - public static final int CONSTRUCTOR = -1258917949; - @Override + public CallDiscardReasonEmpty() {} + + + public CallDiscardReasonEmpty(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallDiscardReasonMissed extends CallDiscardReason { - - public CallDiscardReasonMissed() { - } - public static final int CONSTRUCTOR = 1680358012; - @Override + public CallDiscardReasonMissed() {} + + + public CallDiscardReasonMissed(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallDiscardReasonDeclined extends CallDiscardReason { - - public CallDiscardReasonDeclined() { - } - public static final int CONSTRUCTOR = -1729926094; - @Override + public CallDiscardReasonDeclined() {} + + + public CallDiscardReasonDeclined(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallDiscardReasonDisconnected extends CallDiscardReason { - - public CallDiscardReasonDisconnected() { - } - public static final int CONSTRUCTOR = -1342872670; - @Override + public CallDiscardReasonDisconnected() {} + + + public CallDiscardReasonDisconnected(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallDiscardReasonHungUp extends CallDiscardReason { - - public CallDiscardReasonHungUp() { - } - public static final int CONSTRUCTOR = 438216166; - @Override + public CallDiscardReasonHungUp() {} + + + public CallDiscardReasonHungUp(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallId extends Object { public int id; - public CallId() { - } + public static final int CONSTRUCTOR = 65717769; + + public CallId() {} public CallId(int id) { this.id = id; } - public static final int CONSTRUCTOR = 65717769; + public CallId(DataInputStream input) throws IOException { + this.id = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class CallProblem extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + } } public static class CallProblemEcho extends CallProblem { - - public CallProblemEcho() { - } - public static final int CONSTRUCTOR = 801116548; - @Override + public CallProblemEcho() {} + + + public CallProblemEcho(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProblemNoise extends CallProblem { - - public CallProblemNoise() { - } - public static final int CONSTRUCTOR = 1053065359; - @Override + public CallProblemNoise() {} + + + public CallProblemNoise(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProblemInterruptions extends CallProblem { - - public CallProblemInterruptions() { - } - public static final int CONSTRUCTOR = 1119493218; - @Override + public CallProblemInterruptions() {} + + + public CallProblemInterruptions(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProblemDistortedSpeech extends CallProblem { - - public CallProblemDistortedSpeech() { - } - public static final int CONSTRUCTOR = 379960581; - @Override + public CallProblemDistortedSpeech() {} + + + public CallProblemDistortedSpeech(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProblemSilentLocal extends CallProblem { - - public CallProblemSilentLocal() { - } - public static final int CONSTRUCTOR = 253652790; - @Override + public CallProblemSilentLocal() {} + + + public CallProblemSilentLocal(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProblemSilentRemote extends CallProblem { - - public CallProblemSilentRemote() { - } - public static final int CONSTRUCTOR = 573634714; - @Override + public CallProblemSilentRemote() {} + + + public CallProblemSilentRemote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProblemDropped extends CallProblem { - - public CallProblemDropped() { - } - public static final int CONSTRUCTOR = -1207311487; - @Override + public CallProblemDropped() {} + + + public CallProblemDropped(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallProtocol extends Object { @@ -986,8 +4517,9 @@ public class TdApi { public int maxLayer; public String[] libraryVersions; - public CallProtocol() { - } + public static final int CONSTRUCTOR = -1075562897; + + public CallProtocol() {} public CallProtocol(boolean udpP2p, boolean udpReflector, int minLayer, int maxLayer, String[] libraryVersions) { this.udpP2p = udpP2p; @@ -997,48 +4529,83 @@ public class TdApi { this.libraryVersions = libraryVersions; } - public static final int CONSTRUCTOR = -1075562897; + public CallProtocol(DataInputStream input) throws IOException { + this.udpP2p = input.readBoolean(); + this.udpReflector = input.readBoolean(); + this.minLayer = input.readInt(); + this.maxLayer = input.readInt(); + this.libraryVersions = new String[input.readInt()]; + for (int i = 0; i < this.libraryVersions.length; i++) { + var libraryVersionsTmp = new byte[input.readInt()]; + input.readFully(libraryVersionsTmp); + this.libraryVersions[i] = new String(libraryVersionsTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class CallState extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.udpP2p); + output.writeBoolean(this.udpReflector); + output.writeInt(this.minLayer); + output.writeInt(this.maxLayer); + output.writeInt(this.libraryVersions.length); + for (int i = 0; i < this.libraryVersions.length; i++) { + var libraryVersionsTmp = this.libraryVersions[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(libraryVersionsTmp.length); + output.write(libraryVersionsTmp); + } + } } public static class CallStatePending extends CallState { public boolean isCreated; public boolean isReceived; - public CallStatePending() { - } + public static final int CONSTRUCTOR = 1073048620; + + public CallStatePending() {} public CallStatePending(boolean isCreated, boolean isReceived) { this.isCreated = isCreated; this.isReceived = isReceived; } - public static final int CONSTRUCTOR = 1073048620; + public CallStatePending(DataInputStream input) throws IOException { + this.isCreated = input.readBoolean(); + this.isReceived = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isCreated); + output.writeBoolean(this.isReceived); + } } public static class CallStateExchangingKeys extends CallState { - - public CallStateExchangingKeys() { - } - public static final int CONSTRUCTOR = -1848149403; - @Override + public CallStateExchangingKeys() {} + + + public CallStateExchangingKeys(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallStateReady extends CallState { @@ -1049,8 +4616,9 @@ public class TdApi { public String[] emojis; public boolean allowP2p; - public CallStateReady() { - } + public static final int CONSTRUCTOR = 1848397705; + + public CallStateReady() {} public CallStateReady(CallProtocol protocol, CallConnection[] connections, String config, byte[] encryptionKey, String[] emojis, boolean allowP2p) { this.protocol = protocol; @@ -1061,25 +4629,88 @@ public class TdApi { this.allowP2p = allowP2p; } - public static final int CONSTRUCTOR = 1848397705; + public CallStateReady(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (CallProtocol.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.protocol = new CallProtocol(input); + } + this.connections = new CallConnection[input.readInt()]; + for (int i = 0; i < this.connections.length; i++) { + if (CallConnection.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.connections[i] = new CallConnection(input); + } + if (input.readBoolean()) { + var configTmp = new byte[input.readInt()]; + input.readFully(configTmp); + this.config = new String(configTmp, StandardCharsets.UTF_8); + } + this.encryptionKey = new byte[input.readInt()]; + input.readFully(this.encryptionKey); + this.emojis = new String[input.readInt()]; + for (int i = 0; i < this.emojis.length; i++) { + var emojisTmp = new byte[input.readInt()]; + input.readFully(emojisTmp); + this.emojis[i] = new String(emojisTmp, StandardCharsets.UTF_8); + } + this.allowP2p = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.protocol == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.protocol.serialize(output); + } + output.writeInt(this.connections.length); + for (int i = 0; i < this.connections.length; i++) { + this.connections[i].serialize(output); + } + if (this.config == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var configTmp = this.config.getBytes(StandardCharsets.UTF_8); + output.writeInt(configTmp.length); + output.write(configTmp); + } + output.writeInt(this.encryptionKey.length); + output.write(this.encryptionKey); + output.writeInt(this.emojis.length); + for (int i = 0; i < this.emojis.length; i++) { + var emojisTmp = this.emojis[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(emojisTmp.length); + output.write(emojisTmp); + } + output.writeBoolean(this.allowP2p); + } } public static class CallStateHangingUp extends CallState { - - public CallStateHangingUp() { - } - public static final int CONSTRUCTOR = -2133790038; - @Override + public CallStateHangingUp() {} + + + public CallStateHangingUp(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CallStateDiscarded extends CallState { @@ -1087,8 +4718,9 @@ public class TdApi { public boolean needRating; public boolean needDebugInformation; - public CallStateDiscarded() { - } + public static final int CONSTRUCTOR = -190853167; + + public CallStateDiscarded() {} public CallStateDiscarded(CallDiscardReason reason, boolean needRating, boolean needDebugInformation) { this.reason = reason; @@ -1096,30 +4728,82 @@ public class TdApi { this.needDebugInformation = needDebugInformation; } - public static final int CONSTRUCTOR = -190853167; + public CallStateDiscarded(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case CallDiscardReasonEmpty.CONSTRUCTOR: + this.reason = new CallDiscardReasonEmpty(input); + break; + case CallDiscardReasonMissed.CONSTRUCTOR: + this.reason = new CallDiscardReasonMissed(input); + break; + case CallDiscardReasonDeclined.CONSTRUCTOR: + this.reason = new CallDiscardReasonDeclined(input); + break; + case CallDiscardReasonDisconnected.CONSTRUCTOR: + this.reason = new CallDiscardReasonDisconnected(input); + break; + case CallDiscardReasonHungUp.CONSTRUCTOR: + this.reason = new CallDiscardReasonHungUp(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.needRating = input.readBoolean(); + this.needDebugInformation = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.reason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.reason.serialize(output); + } + output.writeBoolean(this.needRating); + output.writeBoolean(this.needDebugInformation); + } } public static class CallStateError extends CallState { public Error error; - public CallStateError() { - } + public static final int CONSTRUCTOR = -975215467; + + public CallStateError() {} public CallStateError(Error error) { this.error = error; } - public static final int CONSTRUCTOR = -975215467; + public CallStateError(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Error.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.error = new Error(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.error == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.error.serialize(output); + } + } } public static class CallbackQueryAnswer extends Object { @@ -1127,8 +4811,9 @@ public class TdApi { public boolean showAlert; public String url; - public CallbackQueryAnswer() { - } + public static final int CONSTRUCTOR = 360867933; + + public CallbackQueryAnswer() {} public CallbackQueryAnswer(String text, boolean showAlert, String url) { this.text = text; @@ -1136,116 +4821,193 @@ public class TdApi { this.url = url; } - public static final int CONSTRUCTOR = 360867933; + public CallbackQueryAnswer(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + this.showAlert = input.readBoolean(); + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class CallbackQueryPayload extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + output.writeBoolean(this.showAlert); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class CallbackQueryPayloadData extends CallbackQueryPayload { public byte[] data; - public CallbackQueryPayloadData() { - } + public static final int CONSTRUCTOR = -1977729946; + + public CallbackQueryPayloadData() {} public CallbackQueryPayloadData(byte[] data) { this.data = data; } - public static final int CONSTRUCTOR = -1977729946; + public CallbackQueryPayloadData(DataInputStream input) throws IOException { + this.data = new byte[input.readInt()]; + input.readFully(this.data); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.data.length); + output.write(this.data); + } } public static class CallbackQueryPayloadGame extends CallbackQueryPayload { public String gameShortName; - public CallbackQueryPayloadGame() { - } + public static final int CONSTRUCTOR = 1303571512; + + public CallbackQueryPayloadGame() {} public CallbackQueryPayloadGame(String gameShortName) { this.gameShortName = gameShortName; } - public static final int CONSTRUCTOR = 1303571512; + public CallbackQueryPayloadGame(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var gameShortNameTmp = new byte[input.readInt()]; + input.readFully(gameShortNameTmp); + this.gameShortName = new String(gameShortNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class CanTransferOwnershipResult extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.gameShortName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var gameShortNameTmp = this.gameShortName.getBytes(StandardCharsets.UTF_8); + output.writeInt(gameShortNameTmp.length); + output.write(gameShortNameTmp); + } + } } public static class CanTransferOwnershipResultOk extends CanTransferOwnershipResult { - - public CanTransferOwnershipResultOk() { - } - public static final int CONSTRUCTOR = -89881021; - @Override + public CanTransferOwnershipResultOk() {} + + + public CanTransferOwnershipResultOk(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CanTransferOwnershipResultPasswordNeeded extends CanTransferOwnershipResult { - - public CanTransferOwnershipResultPasswordNeeded() { - } - public static final int CONSTRUCTOR = 1548372703; - @Override + public CanTransferOwnershipResultPasswordNeeded() {} + + + public CanTransferOwnershipResultPasswordNeeded(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CanTransferOwnershipResultPasswordTooFresh extends CanTransferOwnershipResult { public int retryAfter; - public CanTransferOwnershipResultPasswordTooFresh() { - } + public static final int CONSTRUCTOR = 811440913; + + public CanTransferOwnershipResultPasswordTooFresh() {} public CanTransferOwnershipResultPasswordTooFresh(int retryAfter) { this.retryAfter = retryAfter; } - public static final int CONSTRUCTOR = 811440913; + public CanTransferOwnershipResultPasswordTooFresh(DataInputStream input) throws IOException { + this.retryAfter = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.retryAfter); + } } public static class CanTransferOwnershipResultSessionTooFresh extends CanTransferOwnershipResult { public int retryAfter; - public CanTransferOwnershipResultSessionTooFresh() { - } + public static final int CONSTRUCTOR = 984664289; + + public CanTransferOwnershipResultSessionTooFresh() {} public CanTransferOwnershipResultSessionTooFresh(int retryAfter) { this.retryAfter = retryAfter; } - public static final int CONSTRUCTOR = 984664289; + public CanTransferOwnershipResultSessionTooFresh(DataInputStream input) throws IOException { + this.retryAfter = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.retryAfter); + } } public static class Chat extends Object { @@ -1276,8 +5038,9 @@ public class TdApi { public DraftMessage draftMessage; public String clientData; - public Chat() { - } + public static final int CONSTRUCTOR = -861487386; + + public Chat() {} public Chat(long id, ChatType type, ChatList chatList, String title, ChatPhoto photo, ChatPermissions permissions, Message lastMessage, long order, boolean isPinned, boolean isMarkedAsUnread, boolean isSponsored, boolean hasScheduledMessages, boolean canBeDeletedOnlyForSelf, boolean canBeDeletedForAllUsers, boolean canBeReported, boolean defaultDisableNotification, int unreadCount, long lastReadInboxMessageId, long lastReadOutboxMessageId, int unreadMentionCount, ChatNotificationSettings notificationSettings, ChatActionBar actionBar, long pinnedMessageId, long replyMarkupMessageId, DraftMessage draftMessage, String clientData) { this.id = id; @@ -1308,277 +5071,562 @@ public class TdApi { this.clientData = clientData; } - public static final int CONSTRUCTOR = -861487386; + public Chat(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatTypePrivate.CONSTRUCTOR: + this.type = new ChatTypePrivate(input); + break; + case ChatTypeBasicGroup.CONSTRUCTOR: + this.type = new ChatTypeBasicGroup(input); + break; + case ChatTypeSupergroup.CONSTRUCTOR: + this.type = new ChatTypeSupergroup(input); + break; + case ChatTypeSecret.CONSTRUCTOR: + this.type = new ChatTypeSecret(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (ChatPhoto.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new ChatPhoto(input); + } + if (input.readBoolean()) { + if (ChatPermissions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.permissions = new ChatPermissions(input); + } + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.lastMessage = new Message(input); + } + this.order = input.readLong(); + this.isPinned = input.readBoolean(); + this.isMarkedAsUnread = input.readBoolean(); + this.isSponsored = input.readBoolean(); + this.hasScheduledMessages = input.readBoolean(); + this.canBeDeletedOnlyForSelf = input.readBoolean(); + this.canBeDeletedForAllUsers = input.readBoolean(); + this.canBeReported = input.readBoolean(); + this.defaultDisableNotification = input.readBoolean(); + this.unreadCount = input.readInt(); + this.lastReadInboxMessageId = input.readLong(); + this.lastReadOutboxMessageId = input.readLong(); + this.unreadMentionCount = input.readInt(); + if (input.readBoolean()) { + if (ChatNotificationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notificationSettings = new ChatNotificationSettings(input); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatActionBarReportSpam.CONSTRUCTOR: + this.actionBar = new ChatActionBarReportSpam(input); + break; + case ChatActionBarReportUnrelatedLocation.CONSTRUCTOR: + this.actionBar = new ChatActionBarReportUnrelatedLocation(input); + break; + case ChatActionBarReportAddBlock.CONSTRUCTOR: + this.actionBar = new ChatActionBarReportAddBlock(input); + break; + case ChatActionBarAddContact.CONSTRUCTOR: + this.actionBar = new ChatActionBarAddContact(input); + break; + case ChatActionBarSharePhoneNumber.CONSTRUCTOR: + this.actionBar = new ChatActionBarSharePhoneNumber(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.pinnedMessageId = input.readLong(); + this.replyMarkupMessageId = input.readLong(); + if (input.readBoolean()) { + if (DraftMessage.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.draftMessage = new DraftMessage(input); + } + if (input.readBoolean()) { + var clientDataTmp = new byte[input.readInt()]; + input.readFully(clientDataTmp); + this.clientData = new String(clientDataTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatAction extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.permissions == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.permissions.serialize(output); + } + if (this.lastMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.lastMessage.serialize(output); + } + output.writeLong(this.order); + output.writeBoolean(this.isPinned); + output.writeBoolean(this.isMarkedAsUnread); + output.writeBoolean(this.isSponsored); + output.writeBoolean(this.hasScheduledMessages); + output.writeBoolean(this.canBeDeletedOnlyForSelf); + output.writeBoolean(this.canBeDeletedForAllUsers); + output.writeBoolean(this.canBeReported); + output.writeBoolean(this.defaultDisableNotification); + output.writeInt(this.unreadCount); + output.writeLong(this.lastReadInboxMessageId); + output.writeLong(this.lastReadOutboxMessageId); + output.writeInt(this.unreadMentionCount); + if (this.notificationSettings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.notificationSettings.serialize(output); + } + if (this.actionBar == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.actionBar.serialize(output); + } + output.writeLong(this.pinnedMessageId); + output.writeLong(this.replyMarkupMessageId); + if (this.draftMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.draftMessage.serialize(output); + } + if (this.clientData == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var clientDataTmp = this.clientData.getBytes(StandardCharsets.UTF_8); + output.writeInt(clientDataTmp.length); + output.write(clientDataTmp); + } + } } public static class ChatActionTyping extends ChatAction { - - public ChatActionTyping() { - } - public static final int CONSTRUCTOR = 380122167; - @Override + public ChatActionTyping() {} + + + public ChatActionTyping(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionRecordingVideo extends ChatAction { - - public ChatActionRecordingVideo() { - } - public static final int CONSTRUCTOR = 216553362; - @Override + public ChatActionRecordingVideo() {} + + + public ChatActionRecordingVideo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionUploadingVideo extends ChatAction { public int progress; - public ChatActionUploadingVideo() { - } + public static final int CONSTRUCTOR = 1234185270; + + public ChatActionUploadingVideo() {} public ChatActionUploadingVideo(int progress) { this.progress = progress; } - public static final int CONSTRUCTOR = 1234185270; + public ChatActionUploadingVideo(DataInputStream input) throws IOException { + this.progress = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.progress); + } } public static class ChatActionRecordingVoiceNote extends ChatAction { - - public ChatActionRecordingVoiceNote() { - } - public static final int CONSTRUCTOR = -808850058; - @Override + public ChatActionRecordingVoiceNote() {} + + + public ChatActionRecordingVoiceNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionUploadingVoiceNote extends ChatAction { public int progress; - public ChatActionUploadingVoiceNote() { - } + public static final int CONSTRUCTOR = -613643666; + + public ChatActionUploadingVoiceNote() {} public ChatActionUploadingVoiceNote(int progress) { this.progress = progress; } - public static final int CONSTRUCTOR = -613643666; + public ChatActionUploadingVoiceNote(DataInputStream input) throws IOException { + this.progress = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.progress); + } } public static class ChatActionUploadingPhoto extends ChatAction { public int progress; - public ChatActionUploadingPhoto() { - } + public static final int CONSTRUCTOR = 654240583; + + public ChatActionUploadingPhoto() {} public ChatActionUploadingPhoto(int progress) { this.progress = progress; } - public static final int CONSTRUCTOR = 654240583; + public ChatActionUploadingPhoto(DataInputStream input) throws IOException { + this.progress = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.progress); + } } public static class ChatActionUploadingDocument extends ChatAction { public int progress; - public ChatActionUploadingDocument() { - } + public static final int CONSTRUCTOR = 167884362; + + public ChatActionUploadingDocument() {} public ChatActionUploadingDocument(int progress) { this.progress = progress; } - public static final int CONSTRUCTOR = 167884362; + public ChatActionUploadingDocument(DataInputStream input) throws IOException { + this.progress = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.progress); + } } public static class ChatActionChoosingLocation extends ChatAction { - - public ChatActionChoosingLocation() { - } - public static final int CONSTRUCTOR = -2017893596; - @Override + public ChatActionChoosingLocation() {} + + + public ChatActionChoosingLocation(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionChoosingContact extends ChatAction { - - public ChatActionChoosingContact() { - } - public static final int CONSTRUCTOR = -1222507496; - @Override + public ChatActionChoosingContact() {} + + + public ChatActionChoosingContact(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionStartPlayingGame extends ChatAction { - - public ChatActionStartPlayingGame() { - } - public static final int CONSTRUCTOR = -865884164; - @Override + public ChatActionStartPlayingGame() {} + + + public ChatActionStartPlayingGame(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionRecordingVideoNote extends ChatAction { - - public ChatActionRecordingVideoNote() { - } - public static final int CONSTRUCTOR = 16523393; - @Override + public ChatActionRecordingVideoNote() {} + + + public ChatActionRecordingVideoNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionUploadingVideoNote extends ChatAction { public int progress; - public ChatActionUploadingVideoNote() { - } + public static final int CONSTRUCTOR = 1172364918; + + public ChatActionUploadingVideoNote() {} public ChatActionUploadingVideoNote(int progress) { this.progress = progress; } - public static final int CONSTRUCTOR = 1172364918; + public ChatActionUploadingVideoNote(DataInputStream input) throws IOException { + this.progress = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.progress); + } } public static class ChatActionCancel extends ChatAction { - - public ChatActionCancel() { - } - public static final int CONSTRUCTOR = 1160523958; - @Override + public ChatActionCancel() {} + + + public ChatActionCancel(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatActionBar extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionBarReportSpam extends ChatActionBar { - - public ChatActionBarReportSpam() { - } - public static final int CONSTRUCTOR = -1603417249; - @Override + public ChatActionBarReportSpam() {} + + + public ChatActionBarReportSpam(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionBarReportUnrelatedLocation extends ChatActionBar { - - public ChatActionBarReportUnrelatedLocation() { - } - public static final int CONSTRUCTOR = 758175489; - @Override + public ChatActionBarReportUnrelatedLocation() {} + + + public ChatActionBarReportUnrelatedLocation(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionBarReportAddBlock extends ChatActionBar { - - public ChatActionBarReportAddBlock() { - } - public static final int CONSTRUCTOR = -87894249; - @Override + public ChatActionBarReportAddBlock() {} + + + public ChatActionBarReportAddBlock(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionBarAddContact extends ChatActionBar { - - public ChatActionBarAddContact() { - } - public static final int CONSTRUCTOR = -733325295; - @Override + public ChatActionBarAddContact() {} + + + public ChatActionBarAddContact(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatActionBarSharePhoneNumber extends ChatActionBar { - - public ChatActionBarSharePhoneNumber() { - } - public static final int CONSTRUCTOR = 35188697; - @Override + public ChatActionBarSharePhoneNumber() {} + + + public ChatActionBarSharePhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatAdministrator extends Object { @@ -1586,8 +5634,9 @@ public class TdApi { public String customTitle; public boolean isOwner; - public ChatAdministrator() { - } + public static final int CONSTRUCTOR = 487220942; + + public ChatAdministrator() {} public ChatAdministrator(int userId, String customTitle, boolean isOwner) { this.userId = userId; @@ -1595,30 +5644,67 @@ public class TdApi { this.isOwner = isOwner; } - public static final int CONSTRUCTOR = 487220942; + public ChatAdministrator(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + var customTitleTmp = new byte[input.readInt()]; + input.readFully(customTitleTmp); + this.customTitle = new String(customTitleTmp, StandardCharsets.UTF_8); + } + this.isOwner = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.customTitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var customTitleTmp = this.customTitle.getBytes(StandardCharsets.UTF_8); + output.writeInt(customTitleTmp.length); + output.write(customTitleTmp); + } + output.writeBoolean(this.isOwner); + } } public static class ChatAdministrators extends Object { public ChatAdministrator[] administrators; - public ChatAdministrators() { - } + public static final int CONSTRUCTOR = -2126186435; + + public ChatAdministrators() {} public ChatAdministrators(ChatAdministrator[] administrators) { this.administrators = administrators; } - public static final int CONSTRUCTOR = -2126186435; + public ChatAdministrators(DataInputStream input) throws IOException { + this.administrators = new ChatAdministrator[input.readInt()]; + for (int i = 0; i < this.administrators.length; i++) { + if (ChatAdministrator.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.administrators[i] = new ChatAdministrator(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.administrators.length); + for (int i = 0; i < this.administrators.length; i++) { + this.administrators[i].serialize(output); + } + } } public static class ChatEvent extends Object { @@ -1627,8 +5713,9 @@ public class TdApi { public int userId; public ChatEventAction action; - public ChatEvent() { - } + public static final int CONSTRUCTOR = -609912404; + + public ChatEvent() {} public ChatEvent(long id, int date, int userId, ChatEventAction action) { this.id = id; @@ -1637,148 +5724,365 @@ public class TdApi { this.action = action; } - public static final int CONSTRUCTOR = -609912404; + public ChatEvent(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.date = input.readInt(); + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatEventMessageEdited.CONSTRUCTOR: + this.action = new ChatEventMessageEdited(input); + break; + case ChatEventMessageDeleted.CONSTRUCTOR: + this.action = new ChatEventMessageDeleted(input); + break; + case ChatEventPollStopped.CONSTRUCTOR: + this.action = new ChatEventPollStopped(input); + break; + case ChatEventMessagePinned.CONSTRUCTOR: + this.action = new ChatEventMessagePinned(input); + break; + case ChatEventMessageUnpinned.CONSTRUCTOR: + this.action = new ChatEventMessageUnpinned(input); + break; + case ChatEventMemberJoined.CONSTRUCTOR: + this.action = new ChatEventMemberJoined(input); + break; + case ChatEventMemberLeft.CONSTRUCTOR: + this.action = new ChatEventMemberLeft(input); + break; + case ChatEventMemberInvited.CONSTRUCTOR: + this.action = new ChatEventMemberInvited(input); + break; + case ChatEventMemberPromoted.CONSTRUCTOR: + this.action = new ChatEventMemberPromoted(input); + break; + case ChatEventMemberRestricted.CONSTRUCTOR: + this.action = new ChatEventMemberRestricted(input); + break; + case ChatEventTitleChanged.CONSTRUCTOR: + this.action = new ChatEventTitleChanged(input); + break; + case ChatEventPermissionsChanged.CONSTRUCTOR: + this.action = new ChatEventPermissionsChanged(input); + break; + case ChatEventDescriptionChanged.CONSTRUCTOR: + this.action = new ChatEventDescriptionChanged(input); + break; + case ChatEventUsernameChanged.CONSTRUCTOR: + this.action = new ChatEventUsernameChanged(input); + break; + case ChatEventPhotoChanged.CONSTRUCTOR: + this.action = new ChatEventPhotoChanged(input); + break; + case ChatEventInvitesToggled.CONSTRUCTOR: + this.action = new ChatEventInvitesToggled(input); + break; + case ChatEventLinkedChatChanged.CONSTRUCTOR: + this.action = new ChatEventLinkedChatChanged(input); + break; + case ChatEventSlowModeDelayChanged.CONSTRUCTOR: + this.action = new ChatEventSlowModeDelayChanged(input); + break; + case ChatEventSignMessagesToggled.CONSTRUCTOR: + this.action = new ChatEventSignMessagesToggled(input); + break; + case ChatEventStickerSetChanged.CONSTRUCTOR: + this.action = new ChatEventStickerSetChanged(input); + break; + case ChatEventLocationChanged.CONSTRUCTOR: + this.action = new ChatEventLocationChanged(input); + break; + case ChatEventIsAllHistoryAvailableToggled.CONSTRUCTOR: + this.action = new ChatEventIsAllHistoryAvailableToggled(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatEventAction extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.date); + output.writeInt(this.userId); + if (this.action == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.action.serialize(output); + } + } } public static class ChatEventMessageEdited extends ChatEventAction { public Message oldMessage; public Message newMessage; - public ChatEventMessageEdited() { - } + public static final int CONSTRUCTOR = -430967304; + + public ChatEventMessageEdited() {} public ChatEventMessageEdited(Message oldMessage, Message newMessage) { this.oldMessage = oldMessage; this.newMessage = newMessage; } - public static final int CONSTRUCTOR = -430967304; + public ChatEventMessageEdited(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.oldMessage = new Message(input); + } + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.newMessage = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.oldMessage.serialize(output); + } + if (this.newMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newMessage.serialize(output); + } + } } public static class ChatEventMessageDeleted extends ChatEventAction { public Message message; - public ChatEventMessageDeleted() { - } + public static final int CONSTRUCTOR = -892974601; + + public ChatEventMessageDeleted() {} public ChatEventMessageDeleted(Message message) { this.message = message; } - public static final int CONSTRUCTOR = -892974601; + public ChatEventMessageDeleted(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + } } public static class ChatEventPollStopped extends ChatEventAction { public Message message; - public ChatEventPollStopped() { - } + public static final int CONSTRUCTOR = 2009893861; + + public ChatEventPollStopped() {} public ChatEventPollStopped(Message message) { this.message = message; } - public static final int CONSTRUCTOR = 2009893861; + public ChatEventPollStopped(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + } } public static class ChatEventMessagePinned extends ChatEventAction { public Message message; - public ChatEventMessagePinned() { - } + public static final int CONSTRUCTOR = 438742298; + + public ChatEventMessagePinned() {} public ChatEventMessagePinned(Message message) { this.message = message; } - public static final int CONSTRUCTOR = 438742298; + public ChatEventMessagePinned(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + } } public static class ChatEventMessageUnpinned extends ChatEventAction { - - public ChatEventMessageUnpinned() { - } - public static final int CONSTRUCTOR = 2002594849; - @Override + public ChatEventMessageUnpinned() {} + + + public ChatEventMessageUnpinned(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatEventMemberJoined extends ChatEventAction { - - public ChatEventMemberJoined() { - } - public static final int CONSTRUCTOR = -235468508; - @Override + public ChatEventMemberJoined() {} + + + public ChatEventMemberJoined(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatEventMemberLeft extends ChatEventAction { - - public ChatEventMemberLeft() { - } - public static final int CONSTRUCTOR = -948420593; - @Override + public ChatEventMemberLeft() {} + + + public ChatEventMemberLeft(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatEventMemberInvited extends ChatEventAction { public int userId; public ChatMemberStatus status; - public ChatEventMemberInvited() { - } + public static final int CONSTRUCTOR = -2093688706; + + public ChatEventMemberInvited() {} public ChatEventMemberInvited(int userId, ChatMemberStatus status) { this.userId = userId; this.status = status; } - public static final int CONSTRUCTOR = -2093688706; + public ChatEventMemberInvited(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.status = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.status = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.status = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.status = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.status = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.status = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + } } public static class ChatEventMemberPromoted extends ChatEventAction { @@ -1786,8 +6090,9 @@ public class TdApi { public ChatMemberStatus oldStatus; public ChatMemberStatus newStatus; - public ChatEventMemberPromoted() { - } + public static final int CONSTRUCTOR = 1887176186; + + public ChatEventMemberPromoted() {} public ChatEventMemberPromoted(int userId, ChatMemberStatus oldStatus, ChatMemberStatus newStatus) { this.userId = userId; @@ -1795,12 +6100,78 @@ public class TdApi { this.newStatus = newStatus; } - public static final int CONSTRUCTOR = 1887176186; + public ChatEventMemberPromoted(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.oldStatus == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.oldStatus.serialize(output); + } + if (this.newStatus == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newStatus.serialize(output); + } + } } public static class ChatEventMemberRestricted extends ChatEventAction { @@ -1808,8 +6179,9 @@ public class TdApi { public ChatMemberStatus oldStatus; public ChatMemberStatus newStatus; - public ChatEventMemberRestricted() { - } + public static final int CONSTRUCTOR = 584946294; + + public ChatEventMemberRestricted() {} public ChatEventMemberRestricted(int userId, ChatMemberStatus oldStatus, ChatMemberStatus newStatus) { this.userId = userId; @@ -1817,246 +6189,540 @@ public class TdApi { this.newStatus = newStatus; } - public static final int CONSTRUCTOR = 584946294; + public ChatEventMemberRestricted(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.oldStatus = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.newStatus = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.oldStatus == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.oldStatus.serialize(output); + } + if (this.newStatus == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newStatus.serialize(output); + } + } } public static class ChatEventTitleChanged extends ChatEventAction { public String oldTitle; public String newTitle; - public ChatEventTitleChanged() { - } + public static final int CONSTRUCTOR = 1134103250; + + public ChatEventTitleChanged() {} public ChatEventTitleChanged(String oldTitle, String newTitle) { this.oldTitle = oldTitle; this.newTitle = newTitle; } - public static final int CONSTRUCTOR = 1134103250; + public ChatEventTitleChanged(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var oldTitleTmp = new byte[input.readInt()]; + input.readFully(oldTitleTmp); + this.oldTitle = new String(oldTitleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var newTitleTmp = new byte[input.readInt()]; + input.readFully(newTitleTmp); + this.newTitle = new String(newTitleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldTitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var oldTitleTmp = this.oldTitle.getBytes(StandardCharsets.UTF_8); + output.writeInt(oldTitleTmp.length); + output.write(oldTitleTmp); + } + if (this.newTitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newTitleTmp = this.newTitle.getBytes(StandardCharsets.UTF_8); + output.writeInt(newTitleTmp.length); + output.write(newTitleTmp); + } + } } public static class ChatEventPermissionsChanged extends ChatEventAction { public ChatPermissions oldPermissions; public ChatPermissions newPermissions; - public ChatEventPermissionsChanged() { - } + public static final int CONSTRUCTOR = -1311557720; + + public ChatEventPermissionsChanged() {} public ChatEventPermissionsChanged(ChatPermissions oldPermissions, ChatPermissions newPermissions) { this.oldPermissions = oldPermissions; this.newPermissions = newPermissions; } - public static final int CONSTRUCTOR = -1311557720; + public ChatEventPermissionsChanged(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (ChatPermissions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.oldPermissions = new ChatPermissions(input); + } + if (input.readBoolean()) { + if (ChatPermissions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.newPermissions = new ChatPermissions(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldPermissions == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.oldPermissions.serialize(output); + } + if (this.newPermissions == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newPermissions.serialize(output); + } + } } public static class ChatEventDescriptionChanged extends ChatEventAction { public String oldDescription; public String newDescription; - public ChatEventDescriptionChanged() { - } + public static final int CONSTRUCTOR = 39112478; + + public ChatEventDescriptionChanged() {} public ChatEventDescriptionChanged(String oldDescription, String newDescription) { this.oldDescription = oldDescription; this.newDescription = newDescription; } - public static final int CONSTRUCTOR = 39112478; + public ChatEventDescriptionChanged(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var oldDescriptionTmp = new byte[input.readInt()]; + input.readFully(oldDescriptionTmp); + this.oldDescription = new String(oldDescriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var newDescriptionTmp = new byte[input.readInt()]; + input.readFully(newDescriptionTmp); + this.newDescription = new String(newDescriptionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldDescription == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var oldDescriptionTmp = this.oldDescription.getBytes(StandardCharsets.UTF_8); + output.writeInt(oldDescriptionTmp.length); + output.write(oldDescriptionTmp); + } + if (this.newDescription == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newDescriptionTmp = this.newDescription.getBytes(StandardCharsets.UTF_8); + output.writeInt(newDescriptionTmp.length); + output.write(newDescriptionTmp); + } + } } public static class ChatEventUsernameChanged extends ChatEventAction { public String oldUsername; public String newUsername; - public ChatEventUsernameChanged() { - } + public static final int CONSTRUCTOR = 1728558443; + + public ChatEventUsernameChanged() {} public ChatEventUsernameChanged(String oldUsername, String newUsername) { this.oldUsername = oldUsername; this.newUsername = newUsername; } - public static final int CONSTRUCTOR = 1728558443; + public ChatEventUsernameChanged(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var oldUsernameTmp = new byte[input.readInt()]; + input.readFully(oldUsernameTmp); + this.oldUsername = new String(oldUsernameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var newUsernameTmp = new byte[input.readInt()]; + input.readFully(newUsernameTmp); + this.newUsername = new String(newUsernameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldUsername == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var oldUsernameTmp = this.oldUsername.getBytes(StandardCharsets.UTF_8); + output.writeInt(oldUsernameTmp.length); + output.write(oldUsernameTmp); + } + if (this.newUsername == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newUsernameTmp = this.newUsername.getBytes(StandardCharsets.UTF_8); + output.writeInt(newUsernameTmp.length); + output.write(newUsernameTmp); + } + } } public static class ChatEventPhotoChanged extends ChatEventAction { public Photo oldPhoto; public Photo newPhoto; - public ChatEventPhotoChanged() { - } + public static final int CONSTRUCTOR = 1037662734; + + public ChatEventPhotoChanged() {} public ChatEventPhotoChanged(Photo oldPhoto, Photo newPhoto) { this.oldPhoto = oldPhoto; this.newPhoto = newPhoto; } - public static final int CONSTRUCTOR = 1037662734; + public ChatEventPhotoChanged(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.oldPhoto = new Photo(input); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.newPhoto = new Photo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldPhoto == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.oldPhoto.serialize(output); + } + if (this.newPhoto == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newPhoto.serialize(output); + } + } } public static class ChatEventInvitesToggled extends ChatEventAction { public boolean canInviteUsers; - public ChatEventInvitesToggled() { - } + public static final int CONSTRUCTOR = -62548373; + + public ChatEventInvitesToggled() {} public ChatEventInvitesToggled(boolean canInviteUsers) { this.canInviteUsers = canInviteUsers; } - public static final int CONSTRUCTOR = -62548373; + public ChatEventInvitesToggled(DataInputStream input) throws IOException { + this.canInviteUsers = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.canInviteUsers); + } } public static class ChatEventLinkedChatChanged extends ChatEventAction { public long oldLinkedChatId; public long newLinkedChatId; - public ChatEventLinkedChatChanged() { - } + public static final int CONSTRUCTOR = 1797419439; + + public ChatEventLinkedChatChanged() {} public ChatEventLinkedChatChanged(long oldLinkedChatId, long newLinkedChatId) { this.oldLinkedChatId = oldLinkedChatId; this.newLinkedChatId = newLinkedChatId; } - public static final int CONSTRUCTOR = 1797419439; + public ChatEventLinkedChatChanged(DataInputStream input) throws IOException { + this.oldLinkedChatId = input.readLong(); + this.newLinkedChatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.oldLinkedChatId); + output.writeLong(this.newLinkedChatId); + } } public static class ChatEventSlowModeDelayChanged extends ChatEventAction { public int oldSlowModeDelay; public int newSlowModeDelay; - public ChatEventSlowModeDelayChanged() { - } + public static final int CONSTRUCTOR = -1653195765; + + public ChatEventSlowModeDelayChanged() {} public ChatEventSlowModeDelayChanged(int oldSlowModeDelay, int newSlowModeDelay) { this.oldSlowModeDelay = oldSlowModeDelay; this.newSlowModeDelay = newSlowModeDelay; } - public static final int CONSTRUCTOR = -1653195765; + public ChatEventSlowModeDelayChanged(DataInputStream input) throws IOException { + this.oldSlowModeDelay = input.readInt(); + this.newSlowModeDelay = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.oldSlowModeDelay); + output.writeInt(this.newSlowModeDelay); + } } public static class ChatEventSignMessagesToggled extends ChatEventAction { public boolean signMessages; - public ChatEventSignMessagesToggled() { - } + public static final int CONSTRUCTOR = -1313265634; + + public ChatEventSignMessagesToggled() {} public ChatEventSignMessagesToggled(boolean signMessages) { this.signMessages = signMessages; } - public static final int CONSTRUCTOR = -1313265634; + public ChatEventSignMessagesToggled(DataInputStream input) throws IOException { + this.signMessages = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.signMessages); + } } public static class ChatEventStickerSetChanged extends ChatEventAction { public long oldStickerSetId; public long newStickerSetId; - public ChatEventStickerSetChanged() { - } + public static final int CONSTRUCTOR = -1243130481; + + public ChatEventStickerSetChanged() {} public ChatEventStickerSetChanged(long oldStickerSetId, long newStickerSetId) { this.oldStickerSetId = oldStickerSetId; this.newStickerSetId = newStickerSetId; } - public static final int CONSTRUCTOR = -1243130481; + public ChatEventStickerSetChanged(DataInputStream input) throws IOException { + this.oldStickerSetId = input.readLong(); + this.newStickerSetId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.oldStickerSetId); + output.writeLong(this.newStickerSetId); + } } public static class ChatEventLocationChanged extends ChatEventAction { public ChatLocation oldLocation; public ChatLocation newLocation; - public ChatEventLocationChanged() { - } + public static final int CONSTRUCTOR = -405930674; + + public ChatEventLocationChanged() {} public ChatEventLocationChanged(ChatLocation oldLocation, ChatLocation newLocation) { this.oldLocation = oldLocation; this.newLocation = newLocation; } - public static final int CONSTRUCTOR = -405930674; + public ChatEventLocationChanged(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (ChatLocation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.oldLocation = new ChatLocation(input); + } + if (input.readBoolean()) { + if (ChatLocation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.newLocation = new ChatLocation(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldLocation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.oldLocation.serialize(output); + } + if (this.newLocation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newLocation.serialize(output); + } + } } public static class ChatEventIsAllHistoryAvailableToggled extends ChatEventAction { public boolean isAllHistoryAvailable; - public ChatEventIsAllHistoryAvailableToggled() { - } + public static final int CONSTRUCTOR = -1599063019; + + public ChatEventIsAllHistoryAvailableToggled() {} public ChatEventIsAllHistoryAvailableToggled(boolean isAllHistoryAvailable) { this.isAllHistoryAvailable = isAllHistoryAvailable; } - public static final int CONSTRUCTOR = -1599063019; + public ChatEventIsAllHistoryAvailableToggled(DataInputStream input) throws IOException { + this.isAllHistoryAvailable = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAllHistoryAvailable); + } } public static class ChatEventLogFilters extends Object { @@ -2071,8 +6737,9 @@ public class TdApi { public boolean infoChanges; public boolean settingChanges; - public ChatEventLogFilters() { - } + public static final int CONSTRUCTOR = 941939684; + + public ChatEventLogFilters() {} public ChatEventLogFilters(boolean messageEdits, boolean messageDeletions, boolean messagePins, boolean memberJoins, boolean memberLeaves, boolean memberInvites, boolean memberPromotions, boolean memberRestrictions, boolean infoChanges, boolean settingChanges) { this.messageEdits = messageEdits; @@ -2087,48 +6754,106 @@ public class TdApi { this.settingChanges = settingChanges; } - public static final int CONSTRUCTOR = 941939684; + public ChatEventLogFilters(DataInputStream input) throws IOException { + this.messageEdits = input.readBoolean(); + this.messageDeletions = input.readBoolean(); + this.messagePins = input.readBoolean(); + this.memberJoins = input.readBoolean(); + this.memberLeaves = input.readBoolean(); + this.memberInvites = input.readBoolean(); + this.memberPromotions = input.readBoolean(); + this.memberRestrictions = input.readBoolean(); + this.infoChanges = input.readBoolean(); + this.settingChanges = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.messageEdits); + output.writeBoolean(this.messageDeletions); + output.writeBoolean(this.messagePins); + output.writeBoolean(this.memberJoins); + output.writeBoolean(this.memberLeaves); + output.writeBoolean(this.memberInvites); + output.writeBoolean(this.memberPromotions); + output.writeBoolean(this.memberRestrictions); + output.writeBoolean(this.infoChanges); + output.writeBoolean(this.settingChanges); + } } public static class ChatEvents extends Object { public ChatEvent[] events; - public ChatEvents() { - } + public static final int CONSTRUCTOR = -585329664; + + public ChatEvents() {} public ChatEvents(ChatEvent[] events) { this.events = events; } - public static final int CONSTRUCTOR = -585329664; + public ChatEvents(DataInputStream input) throws IOException { + this.events = new ChatEvent[input.readInt()]; + for (int i = 0; i < this.events.length; i++) { + if (ChatEvent.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.events[i] = new ChatEvent(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.events.length); + for (int i = 0; i < this.events.length; i++) { + this.events[i].serialize(output); + } + } } public static class ChatInviteLink extends Object { public String inviteLink; - public ChatInviteLink() { - } + public static final int CONSTRUCTOR = -882072492; + + public ChatInviteLink() {} public ChatInviteLink(String inviteLink) { this.inviteLink = inviteLink; } - public static final int CONSTRUCTOR = -882072492; + public ChatInviteLink(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inviteLinkTmp = new byte[input.readInt()]; + input.readFully(inviteLinkTmp); + this.inviteLink = new String(inviteLinkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inviteLink == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inviteLinkTmp = this.inviteLink.getBytes(StandardCharsets.UTF_8); + output.writeInt(inviteLinkTmp.length); + output.write(inviteLinkTmp); + } + } } public static class ChatInviteLinkInfo extends Object { @@ -2140,8 +6865,9 @@ public class TdApi { public int[] memberUserIds; public boolean isPublic; - public ChatInviteLinkInfo() { - } + public static final int CONSTRUCTOR = -323394424; + + public ChatInviteLinkInfo() {} public ChatInviteLinkInfo(long chatId, ChatType type, String title, ChatPhoto photo, int memberCount, int[] memberUserIds, boolean isPublic) { this.chatId = chatId; @@ -2153,61 +6879,165 @@ public class TdApi { this.isPublic = isPublic; } - public static final int CONSTRUCTOR = -323394424; + public ChatInviteLinkInfo(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatTypePrivate.CONSTRUCTOR: + this.type = new ChatTypePrivate(input); + break; + case ChatTypeBasicGroup.CONSTRUCTOR: + this.type = new ChatTypeBasicGroup(input); + break; + case ChatTypeSupergroup.CONSTRUCTOR: + this.type = new ChatTypeSupergroup(input); + break; + case ChatTypeSecret.CONSTRUCTOR: + this.type = new ChatTypeSecret(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (ChatPhoto.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new ChatPhoto(input); + } + this.memberCount = input.readInt(); + this.memberUserIds = new int[input.readInt()]; + for (int i = 0; i < this.memberUserIds.length; i++) { + this.memberUserIds[i] = input.readInt(); + } + this.isPublic = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatList extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + output.writeInt(this.memberCount); + output.writeInt(this.memberUserIds.length); + for (int i = 0; i < this.memberUserIds.length; i++) { + output.writeInt(this.memberUserIds[i]); + } + output.writeBoolean(this.isPublic); + } } public static class ChatListMain extends ChatList { - - public ChatListMain() { - } - public static final int CONSTRUCTOR = -400991316; - @Override + public ChatListMain() {} + + + public ChatListMain(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatListArchive extends ChatList { - - public ChatListArchive() { - } - public static final int CONSTRUCTOR = 362770115; - @Override + public ChatListArchive() {} + + + public ChatListArchive(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatLocation extends Object { public Location location; public String address; - public ChatLocation() { - } + public static final int CONSTRUCTOR = -1566863583; + + public ChatLocation() {} public ChatLocation(Location location, String address) { this.location = location; this.address = address; } - public static final int CONSTRUCTOR = -1566863583; + public ChatLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + if (input.readBoolean()) { + var addressTmp = new byte[input.readInt()]; + input.readFully(addressTmp); + this.address = new String(addressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + if (this.address == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var addressTmp = this.address.getBytes(StandardCharsets.UTF_8); + output.writeInt(addressTmp.length); + output.write(addressTmp); + } + } } public static class ChatMember extends Object { @@ -2217,8 +7047,9 @@ public class TdApi { public ChatMemberStatus status; public BotInfo botInfo; - public ChatMember() { - } + public static final int CONSTRUCTOR = -806137076; + + public ChatMember() {} public ChatMember(int userId, int inviterUserId, int joinedChatDate, ChatMemberStatus status, BotInfo botInfo) { this.userId = userId; @@ -2228,35 +7059,104 @@ public class TdApi { this.botInfo = botInfo; } - public static final int CONSTRUCTOR = -806137076; + public ChatMember(DataInputStream input) throws IOException { + this.userId = input.readInt(); + this.inviterUserId = input.readInt(); + this.joinedChatDate = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.status = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.status = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.status = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.status = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.status = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.status = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (BotInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.botInfo = new BotInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatMemberStatus extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + output.writeInt(this.inviterUserId); + output.writeInt(this.joinedChatDate); + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + if (this.botInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.botInfo.serialize(output); + } + } } public static class ChatMemberStatusCreator extends ChatMemberStatus { public String customTitle; public boolean isMember; - public ChatMemberStatusCreator() { - } + public static final int CONSTRUCTOR = 2038475849; + + public ChatMemberStatusCreator() {} public ChatMemberStatusCreator(String customTitle, boolean isMember) { this.customTitle = customTitle; this.isMember = isMember; } - public static final int CONSTRUCTOR = 2038475849; + public ChatMemberStatusCreator(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var customTitleTmp = new byte[input.readInt()]; + input.readFully(customTitleTmp); + this.customTitle = new String(customTitleTmp, StandardCharsets.UTF_8); + } + this.isMember = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.customTitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var customTitleTmp = this.customTitle.getBytes(StandardCharsets.UTF_8); + output.writeInt(customTitleTmp.length); + output.write(customTitleTmp); + } + output.writeBoolean(this.isMember); + } } public static class ChatMemberStatusAdministrator extends ChatMemberStatus { @@ -2271,8 +7171,9 @@ public class TdApi { public boolean canPinMessages; public boolean canPromoteMembers; - public ChatMemberStatusAdministrator() { - } + public static final int CONSTRUCTOR = 1800612058; + + public ChatMemberStatusAdministrator() {} public ChatMemberStatusAdministrator(String customTitle, boolean canBeEdited, boolean canChangeInfo, boolean canPostMessages, boolean canEditMessages, boolean canDeleteMessages, boolean canInviteUsers, boolean canRestrictMembers, boolean canPinMessages, boolean canPromoteMembers) { this.customTitle = customTitle; @@ -2287,25 +7188,65 @@ public class TdApi { this.canPromoteMembers = canPromoteMembers; } - public static final int CONSTRUCTOR = 1800612058; + public ChatMemberStatusAdministrator(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var customTitleTmp = new byte[input.readInt()]; + input.readFully(customTitleTmp); + this.customTitle = new String(customTitleTmp, StandardCharsets.UTF_8); + } + this.canBeEdited = input.readBoolean(); + this.canChangeInfo = input.readBoolean(); + this.canPostMessages = input.readBoolean(); + this.canEditMessages = input.readBoolean(); + this.canDeleteMessages = input.readBoolean(); + this.canInviteUsers = input.readBoolean(); + this.canRestrictMembers = input.readBoolean(); + this.canPinMessages = input.readBoolean(); + this.canPromoteMembers = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.customTitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var customTitleTmp = this.customTitle.getBytes(StandardCharsets.UTF_8); + output.writeInt(customTitleTmp.length); + output.write(customTitleTmp); + } + output.writeBoolean(this.canBeEdited); + output.writeBoolean(this.canChangeInfo); + output.writeBoolean(this.canPostMessages); + output.writeBoolean(this.canEditMessages); + output.writeBoolean(this.canDeleteMessages); + output.writeBoolean(this.canInviteUsers); + output.writeBoolean(this.canRestrictMembers); + output.writeBoolean(this.canPinMessages); + output.writeBoolean(this.canPromoteMembers); + } } public static class ChatMemberStatusMember extends ChatMemberStatus { - - public ChatMemberStatusMember() { - } - public static final int CONSTRUCTOR = 844723285; - @Override + public ChatMemberStatusMember() {} + + + public ChatMemberStatusMember(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMemberStatusRestricted extends ChatMemberStatus { @@ -2313,8 +7254,9 @@ public class TdApi { public int restrictedUntilDate; public ChatPermissions permissions; - public ChatMemberStatusRestricted() { - } + public static final int CONSTRUCTOR = 1661432998; + + public ChatMemberStatusRestricted() {} public ChatMemberStatusRestricted(boolean isMember, int restrictedUntilDate, ChatPermissions permissions) { this.isMember = isMember; @@ -2322,164 +7264,250 @@ public class TdApi { this.permissions = permissions; } - public static final int CONSTRUCTOR = 1661432998; + public ChatMemberStatusRestricted(DataInputStream input) throws IOException { + this.isMember = input.readBoolean(); + this.restrictedUntilDate = input.readInt(); + if (input.readBoolean()) { + if (ChatPermissions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.permissions = new ChatPermissions(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isMember); + output.writeInt(this.restrictedUntilDate); + if (this.permissions == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.permissions.serialize(output); + } + } } public static class ChatMemberStatusLeft extends ChatMemberStatus { - - public ChatMemberStatusLeft() { - } - public static final int CONSTRUCTOR = -5815259; - @Override + public ChatMemberStatusLeft() {} + + + public ChatMemberStatusLeft(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMemberStatusBanned extends ChatMemberStatus { public int bannedUntilDate; - public ChatMemberStatusBanned() { - } + public static final int CONSTRUCTOR = -1653518666; + + public ChatMemberStatusBanned() {} public ChatMemberStatusBanned(int bannedUntilDate) { this.bannedUntilDate = bannedUntilDate; } - public static final int CONSTRUCTOR = -1653518666; + public ChatMemberStatusBanned(DataInputStream input) throws IOException { + this.bannedUntilDate = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.bannedUntilDate); + } } public static class ChatMembers extends Object { public int totalCount; public ChatMember[] members; - public ChatMembers() { - } + public static final int CONSTRUCTOR = -497558622; + + public ChatMembers() {} public ChatMembers(int totalCount, ChatMember[] members) { this.totalCount = totalCount; this.members = members; } - public static final int CONSTRUCTOR = -497558622; + public ChatMembers(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + this.members = new ChatMember[input.readInt()]; + for (int i = 0; i < this.members.length; i++) { + if (ChatMember.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.members[i] = new ChatMember(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatMembersFilter extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + output.writeInt(this.members.length); + for (int i = 0; i < this.members.length; i++) { + this.members[i].serialize(output); + } + } } public static class ChatMembersFilterContacts extends ChatMembersFilter { - - public ChatMembersFilterContacts() { - } - public static final int CONSTRUCTOR = 1774485671; - @Override + public ChatMembersFilterContacts() {} + + + public ChatMembersFilterContacts(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMembersFilterAdministrators extends ChatMembersFilter { - - public ChatMembersFilterAdministrators() { - } - public static final int CONSTRUCTOR = -1266893796; - @Override + public ChatMembersFilterAdministrators() {} + + + public ChatMembersFilterAdministrators(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMembersFilterMembers extends ChatMembersFilter { - - public ChatMembersFilterMembers() { - } - public static final int CONSTRUCTOR = 670504342; - @Override + public ChatMembersFilterMembers() {} + + + public ChatMembersFilterMembers(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMembersFilterRestricted extends ChatMembersFilter { - - public ChatMembersFilterRestricted() { - } - public static final int CONSTRUCTOR = 1256282813; - @Override + public ChatMembersFilterRestricted() {} + + + public ChatMembersFilterRestricted(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMembersFilterBanned extends ChatMembersFilter { - - public ChatMembersFilterBanned() { - } - public static final int CONSTRUCTOR = -1863102648; - @Override + public ChatMembersFilterBanned() {} + + + public ChatMembersFilterBanned(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatMembersFilterBots extends ChatMembersFilter { - - public ChatMembersFilterBots() { - } - public static final int CONSTRUCTOR = -1422567288; - @Override + public ChatMembersFilterBots() {} + + + public ChatMembersFilterBots(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatNearby extends Object { public long chatId; public int distance; - public ChatNearby() { - } + public static final int CONSTRUCTOR = 48120405; + + public ChatNearby() {} public ChatNearby(long chatId, int distance) { this.chatId = chatId; this.distance = distance; } - public static final int CONSTRUCTOR = 48120405; + public ChatNearby(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.distance = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.distance); + } } public static class ChatNotificationSettings extends Object { @@ -2494,8 +7522,9 @@ public class TdApi { public boolean useDefaultDisableMentionNotifications; public boolean disableMentionNotifications; - public ChatNotificationSettings() { - } + public static final int CONSTRUCTOR = 1503183218; + + public ChatNotificationSettings() {} public ChatNotificationSettings(boolean useDefaultMuteFor, int muteFor, boolean useDefaultSound, String sound, boolean useDefaultShowPreview, boolean showPreview, boolean useDefaultDisablePinnedMessageNotifications, boolean disablePinnedMessageNotifications, boolean useDefaultDisableMentionNotifications, boolean disableMentionNotifications) { this.useDefaultMuteFor = useDefaultMuteFor; @@ -2510,12 +7539,47 @@ public class TdApi { this.disableMentionNotifications = disableMentionNotifications; } - public static final int CONSTRUCTOR = 1503183218; + public ChatNotificationSettings(DataInputStream input) throws IOException { + this.useDefaultMuteFor = input.readBoolean(); + this.muteFor = input.readInt(); + this.useDefaultSound = input.readBoolean(); + if (input.readBoolean()) { + var soundTmp = new byte[input.readInt()]; + input.readFully(soundTmp); + this.sound = new String(soundTmp, StandardCharsets.UTF_8); + } + this.useDefaultShowPreview = input.readBoolean(); + this.showPreview = input.readBoolean(); + this.useDefaultDisablePinnedMessageNotifications = input.readBoolean(); + this.disablePinnedMessageNotifications = input.readBoolean(); + this.useDefaultDisableMentionNotifications = input.readBoolean(); + this.disableMentionNotifications = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.useDefaultMuteFor); + output.writeInt(this.muteFor); + output.writeBoolean(this.useDefaultSound); + if (this.sound == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var soundTmp = this.sound.getBytes(StandardCharsets.UTF_8); + output.writeInt(soundTmp.length); + output.write(soundTmp); + } + output.writeBoolean(this.useDefaultShowPreview); + output.writeBoolean(this.showPreview); + output.writeBoolean(this.useDefaultDisablePinnedMessageNotifications); + output.writeBoolean(this.disablePinnedMessageNotifications); + output.writeBoolean(this.useDefaultDisableMentionNotifications); + output.writeBoolean(this.disableMentionNotifications); + } } public static class ChatPermissions extends Object { @@ -2528,8 +7592,9 @@ public class TdApi { public boolean canInviteUsers; public boolean canPinMessages; - public ChatPermissions() { - } + public static final int CONSTRUCTOR = 1584650463; + + public ChatPermissions() {} public ChatPermissions(boolean canSendMessages, boolean canSendMediaMessages, boolean canSendPolls, boolean canSendOtherMessages, boolean canAddWebPagePreviews, boolean canChangeInfo, boolean canInviteUsers, boolean canPinMessages) { this.canSendMessages = canSendMessages; @@ -2542,131 +7607,225 @@ public class TdApi { this.canPinMessages = canPinMessages; } - public static final int CONSTRUCTOR = 1584650463; + public ChatPermissions(DataInputStream input) throws IOException { + this.canSendMessages = input.readBoolean(); + this.canSendMediaMessages = input.readBoolean(); + this.canSendPolls = input.readBoolean(); + this.canSendOtherMessages = input.readBoolean(); + this.canAddWebPagePreviews = input.readBoolean(); + this.canChangeInfo = input.readBoolean(); + this.canInviteUsers = input.readBoolean(); + this.canPinMessages = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.canSendMessages); + output.writeBoolean(this.canSendMediaMessages); + output.writeBoolean(this.canSendPolls); + output.writeBoolean(this.canSendOtherMessages); + output.writeBoolean(this.canAddWebPagePreviews); + output.writeBoolean(this.canChangeInfo); + output.writeBoolean(this.canInviteUsers); + output.writeBoolean(this.canPinMessages); + } } public static class ChatPhoto extends Object { public File small; public File big; - public ChatPhoto() { - } + public static final int CONSTRUCTOR = -217062456; + + public ChatPhoto() {} public ChatPhoto(File small, File big) { this.small = small; this.big = big; } - public static final int CONSTRUCTOR = -217062456; + public ChatPhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.small = new File(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.big = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatReportReason extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.small == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.small.serialize(output); + } + if (this.big == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.big.serialize(output); + } + } } public static class ChatReportReasonSpam extends ChatReportReason { - - public ChatReportReasonSpam() { - } - public static final int CONSTRUCTOR = -510848863; - @Override + public ChatReportReasonSpam() {} + + + public ChatReportReasonSpam(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatReportReasonViolence extends ChatReportReason { - - public ChatReportReasonViolence() { - } - public static final int CONSTRUCTOR = -1330235395; - @Override + public ChatReportReasonViolence() {} + + + public ChatReportReasonViolence(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatReportReasonPornography extends ChatReportReason { - - public ChatReportReasonPornography() { - } - public static final int CONSTRUCTOR = 722614385; - @Override + public ChatReportReasonPornography() {} + + + public ChatReportReasonPornography(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatReportReasonChildAbuse extends ChatReportReason { - - public ChatReportReasonChildAbuse() { - } - public static final int CONSTRUCTOR = -1070686531; - @Override + public ChatReportReasonChildAbuse() {} + + + public ChatReportReasonChildAbuse(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatReportReasonCopyright extends ChatReportReason { - - public ChatReportReasonCopyright() { - } - public static final int CONSTRUCTOR = 986898080; - @Override + public ChatReportReasonCopyright() {} + + + public ChatReportReasonCopyright(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatReportReasonUnrelatedLocation extends ChatReportReason { - - public ChatReportReasonUnrelatedLocation() { - } - public static final int CONSTRUCTOR = 2632403; - @Override + public ChatReportReasonUnrelatedLocation() {} + + + public ChatReportReasonUnrelatedLocation(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ChatReportReasonCustom extends ChatReportReason { public String text; - public ChatReportReasonCustom() { - } + public static final int CONSTRUCTOR = 544575454; + + public ChatReportReasonCustom() {} public ChatReportReasonCustom(String text) { this.text = text; } - public static final int CONSTRUCTOR = 544575454; + public ChatReportReasonCustom(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + } } public static class ChatStatistics extends Object { @@ -2686,8 +7845,9 @@ public class TdApi { public StatisticsGraph instantViewInteractionGraph; public ChatStatisticsMessageInteractionCounters[] recentMessageInteractions; - public ChatStatistics() { - } + public static final int CONSTRUCTOR = -1209139741; + + public ChatStatistics() {} public ChatStatistics(DateRange period, StatisticsValue memberCount, StatisticsValue meanViewCount, StatisticsValue meanShareCount, double enabledNotificationsPercentage, StatisticsGraph memberCountGraph, StatisticsGraph joinGraph, StatisticsGraph muteGraph, StatisticsGraph viewCountByHourGraph, StatisticsGraph viewCountBySourceGraph, StatisticsGraph joinBySourceGraph, StatisticsGraph languageGraph, StatisticsGraph messageInteractionGraph, StatisticsGraph instantViewInteractionGraph, ChatStatisticsMessageInteractionCounters[] recentMessageInteractions) { this.period = period; @@ -2707,12 +7867,266 @@ public class TdApi { this.recentMessageInteractions = recentMessageInteractions; } - public static final int CONSTRUCTOR = -1209139741; + public ChatStatistics(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (DateRange.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.period = new DateRange(input); + } + if (input.readBoolean()) { + if (StatisticsValue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.memberCount = new StatisticsValue(input); + } + if (input.readBoolean()) { + if (StatisticsValue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.meanViewCount = new StatisticsValue(input); + } + if (input.readBoolean()) { + if (StatisticsValue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.meanShareCount = new StatisticsValue(input); + } + this.enabledNotificationsPercentage = input.readDouble(); + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.memberCountGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.memberCountGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.memberCountGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.joinGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.joinGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.joinGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.muteGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.muteGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.muteGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.viewCountByHourGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.viewCountByHourGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.viewCountByHourGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.viewCountBySourceGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.viewCountBySourceGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.viewCountBySourceGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.joinBySourceGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.joinBySourceGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.joinBySourceGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.languageGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.languageGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.languageGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.messageInteractionGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.messageInteractionGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.messageInteractionGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case StatisticsGraphData.CONSTRUCTOR: + this.instantViewInteractionGraph = new StatisticsGraphData(input); + break; + case StatisticsGraphAsync.CONSTRUCTOR: + this.instantViewInteractionGraph = new StatisticsGraphAsync(input); + break; + case StatisticsGraphError.CONSTRUCTOR: + this.instantViewInteractionGraph = new StatisticsGraphError(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.recentMessageInteractions = new ChatStatisticsMessageInteractionCounters[input.readInt()]; + for (int i = 0; i < this.recentMessageInteractions.length; i++) { + if (ChatStatisticsMessageInteractionCounters.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.recentMessageInteractions[i] = new ChatStatisticsMessageInteractionCounters(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.period == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.period.serialize(output); + } + if (this.memberCount == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.memberCount.serialize(output); + } + if (this.meanViewCount == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.meanViewCount.serialize(output); + } + if (this.meanShareCount == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.meanShareCount.serialize(output); + } + output.writeDouble(this.enabledNotificationsPercentage); + if (this.memberCountGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.memberCountGraph.serialize(output); + } + if (this.joinGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.joinGraph.serialize(output); + } + if (this.muteGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.muteGraph.serialize(output); + } + if (this.viewCountByHourGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.viewCountByHourGraph.serialize(output); + } + if (this.viewCountBySourceGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.viewCountBySourceGraph.serialize(output); + } + if (this.joinBySourceGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.joinBySourceGraph.serialize(output); + } + if (this.languageGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.languageGraph.serialize(output); + } + if (this.messageInteractionGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.messageInteractionGraph.serialize(output); + } + if (this.instantViewInteractionGraph == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.instantViewInteractionGraph.serialize(output); + } + output.writeInt(this.recentMessageInteractions.length); + for (int i = 0; i < this.recentMessageInteractions.length; i++) { + this.recentMessageInteractions[i].serialize(output); + } + } } public static class ChatStatisticsMessageInteractionCounters extends Object { @@ -2720,8 +8134,9 @@ public class TdApi { public int viewCount; public int forwardCount; - public ChatStatisticsMessageInteractionCounters() { - } + public static final int CONSTRUCTOR = 928223898; + + public ChatStatisticsMessageInteractionCounters() {} public ChatStatisticsMessageInteractionCounters(long messageId, int viewCount, int forwardCount) { this.messageId = messageId; @@ -2729,197 +8144,298 @@ public class TdApi { this.forwardCount = forwardCount; } - public static final int CONSTRUCTOR = 928223898; + public ChatStatisticsMessageInteractionCounters(DataInputStream input) throws IOException { + this.messageId = input.readLong(); + this.viewCount = input.readInt(); + this.forwardCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ChatType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.messageId); + output.writeInt(this.viewCount); + output.writeInt(this.forwardCount); + } } public static class ChatTypePrivate extends ChatType { public int userId; - public ChatTypePrivate() { - } + public static final int CONSTRUCTOR = 1700720838; + + public ChatTypePrivate() {} public ChatTypePrivate(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = 1700720838; + public ChatTypePrivate(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class ChatTypeBasicGroup extends ChatType { public int basicGroupId; - public ChatTypeBasicGroup() { - } + public static final int CONSTRUCTOR = 21815278; + + public ChatTypeBasicGroup() {} public ChatTypeBasicGroup(int basicGroupId) { this.basicGroupId = basicGroupId; } - public static final int CONSTRUCTOR = 21815278; + public ChatTypeBasicGroup(DataInputStream input) throws IOException { + this.basicGroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.basicGroupId); + } } public static class ChatTypeSupergroup extends ChatType { public int supergroupId; public boolean isChannel; - public ChatTypeSupergroup() { - } + public static final int CONSTRUCTOR = 955152366; + + public ChatTypeSupergroup() {} public ChatTypeSupergroup(int supergroupId, boolean isChannel) { this.supergroupId = supergroupId; this.isChannel = isChannel; } - public static final int CONSTRUCTOR = 955152366; + public ChatTypeSupergroup(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + this.isChannel = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + output.writeBoolean(this.isChannel); + } } public static class ChatTypeSecret extends ChatType { public int secretChatId; public int userId; - public ChatTypeSecret() { - } + public static final int CONSTRUCTOR = 136722563; + + public ChatTypeSecret() {} public ChatTypeSecret(int secretChatId, int userId) { this.secretChatId = secretChatId; this.userId = userId; } - public static final int CONSTRUCTOR = 136722563; + public ChatTypeSecret(DataInputStream input) throws IOException { + this.secretChatId = input.readInt(); + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.secretChatId); + output.writeInt(this.userId); + } } public static class Chats extends Object { public long[] chatIds; - public Chats() { - } + public static final int CONSTRUCTOR = -1687756019; + + public Chats() {} public Chats(long[] chatIds) { this.chatIds = chatIds; } - public static final int CONSTRUCTOR = -1687756019; + public Chats(DataInputStream input) throws IOException { + this.chatIds = new long[input.readInt()]; + for (int i = 0; i < this.chatIds.length; i++) { + this.chatIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.chatIds.length); + for (int i = 0; i < this.chatIds.length; i++) { + output.writeLong(this.chatIds[i]); + } + } } public static class ChatsNearby extends Object { public ChatNearby[] usersNearby; public ChatNearby[] supergroupsNearby; - public ChatsNearby() { - } + public static final int CONSTRUCTOR = 187746081; + + public ChatsNearby() {} public ChatsNearby(ChatNearby[] usersNearby, ChatNearby[] supergroupsNearby) { this.usersNearby = usersNearby; this.supergroupsNearby = supergroupsNearby; } - public static final int CONSTRUCTOR = 187746081; + public ChatsNearby(DataInputStream input) throws IOException { + this.usersNearby = new ChatNearby[input.readInt()]; + for (int i = 0; i < this.usersNearby.length; i++) { + if (ChatNearby.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.usersNearby[i] = new ChatNearby(input); + } + this.supergroupsNearby = new ChatNearby[input.readInt()]; + for (int i = 0; i < this.supergroupsNearby.length; i++) { + if (ChatNearby.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.supergroupsNearby[i] = new ChatNearby(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class CheckChatUsernameResult extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.usersNearby.length); + for (int i = 0; i < this.usersNearby.length; i++) { + this.usersNearby[i].serialize(output); + } + output.writeInt(this.supergroupsNearby.length); + for (int i = 0; i < this.supergroupsNearby.length; i++) { + this.supergroupsNearby[i].serialize(output); + } + } } public static class CheckChatUsernameResultOk extends CheckChatUsernameResult { - - public CheckChatUsernameResultOk() { - } - public static final int CONSTRUCTOR = -1498956964; - @Override + public CheckChatUsernameResultOk() {} + + + public CheckChatUsernameResultOk(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CheckChatUsernameResultUsernameInvalid extends CheckChatUsernameResult { - - public CheckChatUsernameResultUsernameInvalid() { - } - public static final int CONSTRUCTOR = -636979370; - @Override + public CheckChatUsernameResultUsernameInvalid() {} + + + public CheckChatUsernameResultUsernameInvalid(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CheckChatUsernameResultUsernameOccupied extends CheckChatUsernameResult { - - public CheckChatUsernameResultUsernameOccupied() { - } - public static final int CONSTRUCTOR = 1320892201; - @Override + public CheckChatUsernameResultUsernameOccupied() {} + + + public CheckChatUsernameResultUsernameOccupied(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CheckChatUsernameResultPublicChatsTooMuch extends CheckChatUsernameResult { - - public CheckChatUsernameResultPublicChatsTooMuch() { - } - public static final int CONSTRUCTOR = 858247741; - @Override + public CheckChatUsernameResultPublicChatsTooMuch() {} + + + public CheckChatUsernameResultPublicChatsTooMuch(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CheckChatUsernameResultPublicGroupsUnavailable extends CheckChatUsernameResult { - - public CheckChatUsernameResultPublicGroupsUnavailable() { - } - public static final int CONSTRUCTOR = -51833641; - @Override + public CheckChatUsernameResultPublicGroupsUnavailable() {} + + + public CheckChatUsernameResultPublicGroupsUnavailable(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ConnectedWebsite extends Object { @@ -2933,8 +8449,9 @@ public class TdApi { public String ip; public String location; - public ConnectedWebsite() { - } + public static final int CONSTRUCTOR = -1538986855; + + public ConnectedWebsite() {} public ConnectedWebsite(long id, String domainName, int botUserId, String browser, String platform, int logInDate, int lastActiveDate, String ip, String location) { this.id = id; @@ -2948,98 +8465,213 @@ public class TdApi { this.location = location; } - public static final int CONSTRUCTOR = -1538986855; + public ConnectedWebsite(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var domainNameTmp = new byte[input.readInt()]; + input.readFully(domainNameTmp); + this.domainName = new String(domainNameTmp, StandardCharsets.UTF_8); + } + this.botUserId = input.readInt(); + if (input.readBoolean()) { + var browserTmp = new byte[input.readInt()]; + input.readFully(browserTmp); + this.browser = new String(browserTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var platformTmp = new byte[input.readInt()]; + input.readFully(platformTmp); + this.platform = new String(platformTmp, StandardCharsets.UTF_8); + } + this.logInDate = input.readInt(); + this.lastActiveDate = input.readInt(); + if (input.readBoolean()) { + var ipTmp = new byte[input.readInt()]; + input.readFully(ipTmp); + this.ip = new String(ipTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var locationTmp = new byte[input.readInt()]; + input.readFully(locationTmp); + this.location = new String(locationTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.domainName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var domainNameTmp = this.domainName.getBytes(StandardCharsets.UTF_8); + output.writeInt(domainNameTmp.length); + output.write(domainNameTmp); + } + output.writeInt(this.botUserId); + if (this.browser == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var browserTmp = this.browser.getBytes(StandardCharsets.UTF_8); + output.writeInt(browserTmp.length); + output.write(browserTmp); + } + if (this.platform == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var platformTmp = this.platform.getBytes(StandardCharsets.UTF_8); + output.writeInt(platformTmp.length); + output.write(platformTmp); + } + output.writeInt(this.logInDate); + output.writeInt(this.lastActiveDate); + if (this.ip == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var ipTmp = this.ip.getBytes(StandardCharsets.UTF_8); + output.writeInt(ipTmp.length); + output.write(ipTmp); + } + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var locationTmp = this.location.getBytes(StandardCharsets.UTF_8); + output.writeInt(locationTmp.length); + output.write(locationTmp); + } + } } public static class ConnectedWebsites extends Object { public ConnectedWebsite[] websites; - public ConnectedWebsites() { - } + public static final int CONSTRUCTOR = -1727949694; + + public ConnectedWebsites() {} public ConnectedWebsites(ConnectedWebsite[] websites) { this.websites = websites; } - public static final int CONSTRUCTOR = -1727949694; + public ConnectedWebsites(DataInputStream input) throws IOException { + this.websites = new ConnectedWebsite[input.readInt()]; + for (int i = 0; i < this.websites.length; i++) { + if (ConnectedWebsite.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.websites[i] = new ConnectedWebsite(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ConnectionState extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.websites.length); + for (int i = 0; i < this.websites.length; i++) { + this.websites[i].serialize(output); + } + } } public static class ConnectionStateWaitingForNetwork extends ConnectionState { - - public ConnectionStateWaitingForNetwork() { - } - public static final int CONSTRUCTOR = 1695405912; - @Override + public ConnectionStateWaitingForNetwork() {} + + + public ConnectionStateWaitingForNetwork(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ConnectionStateConnectingToProxy extends ConnectionState { - - public ConnectionStateConnectingToProxy() { - } - public static final int CONSTRUCTOR = -93187239; - @Override + public ConnectionStateConnectingToProxy() {} + + + public ConnectionStateConnectingToProxy(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ConnectionStateConnecting extends ConnectionState { - - public ConnectionStateConnecting() { - } - public static final int CONSTRUCTOR = -1298400670; - @Override + public ConnectionStateConnecting() {} + + + public ConnectionStateConnecting(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ConnectionStateUpdating extends ConnectionState { - - public ConnectionStateUpdating() { - } - public static final int CONSTRUCTOR = -188104009; - @Override + public ConnectionStateUpdating() {} + + + public ConnectionStateUpdating(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ConnectionStateReady extends ConnectionState { - - public ConnectionStateReady() { - } - public static final int CONSTRUCTOR = 48608492; - @Override + public ConnectionStateReady() {} + + + public ConnectionStateReady(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class Contact extends Object { @@ -3049,8 +8681,9 @@ public class TdApi { public String vcard; public int userId; - public Contact() { - } + public static final int CONSTRUCTOR = -1483002540; + + public Contact() {} public Contact(String phoneNumber, String firstName, String lastName, String vcard, int userId) { this.phoneNumber = phoneNumber; @@ -3060,66 +8693,167 @@ public class TdApi { this.userId = userId; } - public static final int CONSTRUCTOR = -1483002540; + public Contact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var firstNameTmp = new byte[input.readInt()]; + input.readFully(firstNameTmp); + this.firstName = new String(firstNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var lastNameTmp = new byte[input.readInt()]; + input.readFully(lastNameTmp); + this.lastName = new String(lastNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var vcardTmp = new byte[input.readInt()]; + input.readFully(vcardTmp); + this.vcard = new String(vcardTmp, StandardCharsets.UTF_8); + } + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.firstName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var firstNameTmp = this.firstName.getBytes(StandardCharsets.UTF_8); + output.writeInt(firstNameTmp.length); + output.write(firstNameTmp); + } + if (this.lastName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var lastNameTmp = this.lastName.getBytes(StandardCharsets.UTF_8); + output.writeInt(lastNameTmp.length); + output.write(lastNameTmp); + } + if (this.vcard == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var vcardTmp = this.vcard.getBytes(StandardCharsets.UTF_8); + output.writeInt(vcardTmp.length); + output.write(vcardTmp); + } + output.writeInt(this.userId); + } } public static class Count extends Object { public int count; - public Count() { - } + public static final int CONSTRUCTOR = 1295577348; + + public Count() {} public Count(int count) { this.count = count; } - public static final int CONSTRUCTOR = 1295577348; + public Count(DataInputStream input) throws IOException { + this.count = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.count); + } } public static class CustomRequestResult extends Object { public String result; - public CustomRequestResult() { - } + public static final int CONSTRUCTOR = -2009960452; + + public CustomRequestResult() {} public CustomRequestResult(String result) { this.result = result; } - public static final int CONSTRUCTOR = -2009960452; + public CustomRequestResult(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var resultTmp = new byte[input.readInt()]; + input.readFully(resultTmp); + this.result = new String(resultTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.result == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var resultTmp = this.result.getBytes(StandardCharsets.UTF_8); + output.writeInt(resultTmp.length); + output.write(resultTmp); + } + } } public static class DatabaseStatistics extends Object { public String statistics; - public DatabaseStatistics() { - } + public static final int CONSTRUCTOR = -1123912880; + + public DatabaseStatistics() {} public DatabaseStatistics(String statistics) { this.statistics = statistics; } - public static final int CONSTRUCTOR = -1123912880; + public DatabaseStatistics(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var statisticsTmp = new byte[input.readInt()]; + input.readFully(statisticsTmp); + this.statistics = new String(statisticsTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.statistics == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var statisticsTmp = this.statistics.getBytes(StandardCharsets.UTF_8); + output.writeInt(statisticsTmp.length); + output.write(statisticsTmp); + } + } } public static class Date extends Object { @@ -3127,8 +8861,9 @@ public class TdApi { public int month; public int year; - public Date() { - } + public static final int CONSTRUCTOR = -277956960; + + public Date() {} public Date(int day, int month, int year) { this.day = day; @@ -3136,115 +8871,209 @@ public class TdApi { this.year = year; } - public static final int CONSTRUCTOR = -277956960; + public Date(DataInputStream input) throws IOException { + this.day = input.readInt(); + this.month = input.readInt(); + this.year = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.day); + output.writeInt(this.month); + output.writeInt(this.year); + } } public static class DateRange extends Object { public int startDate; public int endDate; - public DateRange() { - } + public static final int CONSTRUCTOR = 1360333926; + + public DateRange() {} public DateRange(int startDate, int endDate) { this.startDate = startDate; this.endDate = endDate; } - public static final int CONSTRUCTOR = 1360333926; + public DateRange(DataInputStream input) throws IOException { + this.startDate = input.readInt(); + this.endDate = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.startDate); + output.writeInt(this.endDate); + } } public static class DatedFile extends Object { public File file; public int date; - public DatedFile() { - } + public static final int CONSTRUCTOR = -1840795491; + + public DatedFile() {} public DatedFile(File file, int date) { this.file = file; this.date = date; } - public static final int CONSTRUCTOR = -1840795491; + public DatedFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.file = new File(input); + } + this.date = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.file == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.file.serialize(output); + } + output.writeInt(this.date); + } } public static class DeepLinkInfo extends Object { public FormattedText text; public boolean needUpdateApplication; - public DeepLinkInfo() { - } + public static final int CONSTRUCTOR = 1864081662; + + public DeepLinkInfo() {} public DeepLinkInfo(FormattedText text, boolean needUpdateApplication) { this.text = text; this.needUpdateApplication = needUpdateApplication; } - public static final int CONSTRUCTOR = 1864081662; + public DeepLinkInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + this.needUpdateApplication = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class DeviceToken extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + output.writeBoolean(this.needUpdateApplication); + } } public static class DeviceTokenFirebaseCloudMessaging extends DeviceToken { public String token; public boolean encrypt; - public DeviceTokenFirebaseCloudMessaging() { - } + public static final int CONSTRUCTOR = -797881849; + + public DeviceTokenFirebaseCloudMessaging() {} public DeviceTokenFirebaseCloudMessaging(String token, boolean encrypt) { this.token = token; this.encrypt = encrypt; } - public static final int CONSTRUCTOR = -797881849; + public DeviceTokenFirebaseCloudMessaging(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tokenTmp = new byte[input.readInt()]; + input.readFully(tokenTmp); + this.token = new String(tokenTmp, StandardCharsets.UTF_8); + } + this.encrypt = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.token == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tokenTmp = this.token.getBytes(StandardCharsets.UTF_8); + output.writeInt(tokenTmp.length); + output.write(tokenTmp); + } + output.writeBoolean(this.encrypt); + } } public static class DeviceTokenApplePush extends DeviceToken { public String deviceToken; public boolean isAppSandbox; - public DeviceTokenApplePush() { - } + public static final int CONSTRUCTOR = 387541955; + + public DeviceTokenApplePush() {} public DeviceTokenApplePush(String deviceToken, boolean isAppSandbox) { this.deviceToken = deviceToken; this.isAppSandbox = isAppSandbox; } - public static final int CONSTRUCTOR = 387541955; + public DeviceTokenApplePush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var deviceTokenTmp = new byte[input.readInt()]; + input.readFully(deviceTokenTmp); + this.deviceToken = new String(deviceTokenTmp, StandardCharsets.UTF_8); + } + this.isAppSandbox = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.deviceToken == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var deviceTokenTmp = this.deviceToken.getBytes(StandardCharsets.UTF_8); + output.writeInt(deviceTokenTmp.length); + output.write(deviceTokenTmp); + } + output.writeBoolean(this.isAppSandbox); + } } public static class DeviceTokenApplePushVoIP extends DeviceToken { @@ -3252,8 +9081,9 @@ public class TdApi { public boolean isAppSandbox; public boolean encrypt; - public DeviceTokenApplePushVoIP() { - } + public static final int CONSTRUCTOR = 804275689; + + public DeviceTokenApplePushVoIP() {} public DeviceTokenApplePushVoIP(String deviceToken, boolean isAppSandbox, boolean encrypt) { this.deviceToken = deviceToken; @@ -3261,66 +9091,141 @@ public class TdApi { this.encrypt = encrypt; } - public static final int CONSTRUCTOR = 804275689; + public DeviceTokenApplePushVoIP(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var deviceTokenTmp = new byte[input.readInt()]; + input.readFully(deviceTokenTmp); + this.deviceToken = new String(deviceTokenTmp, StandardCharsets.UTF_8); + } + this.isAppSandbox = input.readBoolean(); + this.encrypt = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.deviceToken == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var deviceTokenTmp = this.deviceToken.getBytes(StandardCharsets.UTF_8); + output.writeInt(deviceTokenTmp.length); + output.write(deviceTokenTmp); + } + output.writeBoolean(this.isAppSandbox); + output.writeBoolean(this.encrypt); + } } public static class DeviceTokenWindowsPush extends DeviceToken { public String accessToken; - public DeviceTokenWindowsPush() { - } + public static final int CONSTRUCTOR = -1410514289; + + public DeviceTokenWindowsPush() {} public DeviceTokenWindowsPush(String accessToken) { this.accessToken = accessToken; } - public static final int CONSTRUCTOR = -1410514289; + public DeviceTokenWindowsPush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var accessTokenTmp = new byte[input.readInt()]; + input.readFully(accessTokenTmp); + this.accessToken = new String(accessTokenTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.accessToken == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var accessTokenTmp = this.accessToken.getBytes(StandardCharsets.UTF_8); + output.writeInt(accessTokenTmp.length); + output.write(accessTokenTmp); + } + } } public static class DeviceTokenMicrosoftPush extends DeviceToken { public String channelUri; - public DeviceTokenMicrosoftPush() { - } + public static final int CONSTRUCTOR = 1224269900; + + public DeviceTokenMicrosoftPush() {} public DeviceTokenMicrosoftPush(String channelUri) { this.channelUri = channelUri; } - public static final int CONSTRUCTOR = 1224269900; + public DeviceTokenMicrosoftPush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var channelUriTmp = new byte[input.readInt()]; + input.readFully(channelUriTmp); + this.channelUri = new String(channelUriTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.channelUri == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var channelUriTmp = this.channelUri.getBytes(StandardCharsets.UTF_8); + output.writeInt(channelUriTmp.length); + output.write(channelUriTmp); + } + } } public static class DeviceTokenMicrosoftPushVoIP extends DeviceToken { public String channelUri; - public DeviceTokenMicrosoftPushVoIP() { - } + public static final int CONSTRUCTOR = -785603759; + + public DeviceTokenMicrosoftPushVoIP() {} public DeviceTokenMicrosoftPushVoIP(String channelUri) { this.channelUri = channelUri; } - public static final int CONSTRUCTOR = -785603759; + public DeviceTokenMicrosoftPushVoIP(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var channelUriTmp = new byte[input.readInt()]; + input.readFully(channelUriTmp); + this.channelUri = new String(channelUriTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.channelUri == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var channelUriTmp = this.channelUri.getBytes(StandardCharsets.UTF_8); + output.writeInt(channelUriTmp.length); + output.write(channelUriTmp); + } + } } public static class DeviceTokenWebPush extends DeviceToken { @@ -3328,8 +9233,9 @@ public class TdApi { public String p256dhBase64url; public String authBase64url; - public DeviceTokenWebPush() { - } + public static final int CONSTRUCTOR = -1694507273; + + public DeviceTokenWebPush() {} public DeviceTokenWebPush(String endpoint, String p256dhBase64url, String authBase64url) { this.endpoint = endpoint; @@ -3337,84 +9243,199 @@ public class TdApi { this.authBase64url = authBase64url; } - public static final int CONSTRUCTOR = -1694507273; + public DeviceTokenWebPush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var endpointTmp = new byte[input.readInt()]; + input.readFully(endpointTmp); + this.endpoint = new String(endpointTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var p256dhBase64urlTmp = new byte[input.readInt()]; + input.readFully(p256dhBase64urlTmp); + this.p256dhBase64url = new String(p256dhBase64urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var authBase64urlTmp = new byte[input.readInt()]; + input.readFully(authBase64urlTmp); + this.authBase64url = new String(authBase64urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.endpoint == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var endpointTmp = this.endpoint.getBytes(StandardCharsets.UTF_8); + output.writeInt(endpointTmp.length); + output.write(endpointTmp); + } + if (this.p256dhBase64url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var p256dhBase64urlTmp = this.p256dhBase64url.getBytes(StandardCharsets.UTF_8); + output.writeInt(p256dhBase64urlTmp.length); + output.write(p256dhBase64urlTmp); + } + if (this.authBase64url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var authBase64urlTmp = this.authBase64url.getBytes(StandardCharsets.UTF_8); + output.writeInt(authBase64urlTmp.length); + output.write(authBase64urlTmp); + } + } } public static class DeviceTokenSimplePush extends DeviceToken { public String endpoint; - public DeviceTokenSimplePush() { - } + public static final int CONSTRUCTOR = 49584736; + + public DeviceTokenSimplePush() {} public DeviceTokenSimplePush(String endpoint) { this.endpoint = endpoint; } - public static final int CONSTRUCTOR = 49584736; + public DeviceTokenSimplePush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var endpointTmp = new byte[input.readInt()]; + input.readFully(endpointTmp); + this.endpoint = new String(endpointTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.endpoint == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var endpointTmp = this.endpoint.getBytes(StandardCharsets.UTF_8); + output.writeInt(endpointTmp.length); + output.write(endpointTmp); + } + } } public static class DeviceTokenUbuntuPush extends DeviceToken { public String token; - public DeviceTokenUbuntuPush() { - } + public static final int CONSTRUCTOR = 1782320422; + + public DeviceTokenUbuntuPush() {} public DeviceTokenUbuntuPush(String token) { this.token = token; } - public static final int CONSTRUCTOR = 1782320422; + public DeviceTokenUbuntuPush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tokenTmp = new byte[input.readInt()]; + input.readFully(tokenTmp); + this.token = new String(tokenTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.token == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tokenTmp = this.token.getBytes(StandardCharsets.UTF_8); + output.writeInt(tokenTmp.length); + output.write(tokenTmp); + } + } } public static class DeviceTokenBlackBerryPush extends DeviceToken { public String token; - public DeviceTokenBlackBerryPush() { - } + public static final int CONSTRUCTOR = 1559167234; + + public DeviceTokenBlackBerryPush() {} public DeviceTokenBlackBerryPush(String token) { this.token = token; } - public static final int CONSTRUCTOR = 1559167234; + public DeviceTokenBlackBerryPush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tokenTmp = new byte[input.readInt()]; + input.readFully(tokenTmp); + this.token = new String(tokenTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.token == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tokenTmp = this.token.getBytes(StandardCharsets.UTF_8); + output.writeInt(tokenTmp.length); + output.write(tokenTmp); + } + } } public static class DeviceTokenTizenPush extends DeviceToken { public String regId; - public DeviceTokenTizenPush() { - } + public static final int CONSTRUCTOR = -1359947213; + + public DeviceTokenTizenPush() {} public DeviceTokenTizenPush(String regId) { this.regId = regId; } - public static final int CONSTRUCTOR = -1359947213; + public DeviceTokenTizenPush(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var regIdTmp = new byte[input.readInt()]; + input.readFully(regIdTmp); + this.regId = new String(regIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.regId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var regIdTmp = this.regId.getBytes(StandardCharsets.UTF_8); + output.writeInt(regIdTmp.length); + output.write(regIdTmp); + } + } } public static class Document extends Object { @@ -3424,8 +9445,9 @@ public class TdApi { public PhotoSize thumbnail; public File document; - public Document() { - } + public static final int CONSTRUCTOR = 21881988; + + public Document() {} public Document(String fileName, String mimeType, Minithumbnail minithumbnail, PhotoSize thumbnail, File document) { this.fileName = fileName; @@ -3435,12 +9457,78 @@ public class TdApi { this.document = document; } - public static final int CONSTRUCTOR = 21881988; + public Document(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var fileNameTmp = new byte[input.readInt()]; + input.readFully(fileNameTmp); + this.fileName = new String(fileNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Minithumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.minithumbnail = new Minithumbnail(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fileName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fileNameTmp = this.fileName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fileNameTmp.length); + output.write(fileNameTmp); + } + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + if (this.minithumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.minithumbnail.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + } } public static class DraftMessage extends Object { @@ -3448,8 +9536,9 @@ public class TdApi { public int date; public InputMessageContent inputMessageText; - public DraftMessage() { - } + public static final int CONSTRUCTOR = 1373050112; + + public DraftMessage() {} public DraftMessage(long replyToMessageId, int date, InputMessageContent inputMessageText) { this.replyToMessageId = replyToMessageId; @@ -3457,50 +9546,158 @@ public class TdApi { this.inputMessageText = inputMessageText; } - public static final int CONSTRUCTOR = 1373050112; + public DraftMessage(DataInputStream input) throws IOException { + this.replyToMessageId = input.readLong(); + this.date = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageText = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageText = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageText = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageText = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageText = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageText = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageText = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageText = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageText = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageText = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageText = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageText = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageText = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageText = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageText = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageText = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageText = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.replyToMessageId); + output.writeInt(this.date); + if (this.inputMessageText == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageText.serialize(output); + } + } } public static class EmailAddressAuthenticationCodeInfo extends Object { public String emailAddressPattern; public int length; - public EmailAddressAuthenticationCodeInfo() { - } + public static final int CONSTRUCTOR = 1151066659; + + public EmailAddressAuthenticationCodeInfo() {} public EmailAddressAuthenticationCodeInfo(String emailAddressPattern, int length) { this.emailAddressPattern = emailAddressPattern; this.length = length; } - public static final int CONSTRUCTOR = 1151066659; + public EmailAddressAuthenticationCodeInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emailAddressPatternTmp = new byte[input.readInt()]; + input.readFully(emailAddressPatternTmp); + this.emailAddressPattern = new String(emailAddressPatternTmp, StandardCharsets.UTF_8); + } + this.length = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emailAddressPattern == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emailAddressPatternTmp = this.emailAddressPattern.getBytes(StandardCharsets.UTF_8); + output.writeInt(emailAddressPatternTmp.length); + output.write(emailAddressPatternTmp); + } + output.writeInt(this.length); + } } public static class Emojis extends Object { public String[] emojis; - public Emojis() { - } + public static final int CONSTRUCTOR = 950339552; + + public Emojis() {} public Emojis(String[] emojis) { this.emojis = emojis; } - public static final int CONSTRUCTOR = 950339552; + public Emojis(DataInputStream input) throws IOException { + this.emojis = new String[input.readInt()]; + for (int i = 0; i < this.emojis.length; i++) { + var emojisTmp = new byte[input.readInt()]; + input.readFully(emojisTmp); + this.emojis[i] = new String(emojisTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.emojis.length); + for (int i = 0; i < this.emojis.length; i++) { + var emojisTmp = this.emojis[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(emojisTmp.length); + output.write(emojisTmp); + } + } } public static class EncryptedCredentials extends Object { @@ -3508,8 +9705,9 @@ public class TdApi { public byte[] hash; public byte[] secret; - public EncryptedCredentials() { - } + public static final int CONSTRUCTOR = 1331106766; + + public EncryptedCredentials() {} public EncryptedCredentials(byte[] data, byte[] hash, byte[] secret) { this.data = data; @@ -3517,12 +9715,28 @@ public class TdApi { this.secret = secret; } - public static final int CONSTRUCTOR = 1331106766; + public EncryptedCredentials(DataInputStream input) throws IOException { + this.data = new byte[input.readInt()]; + input.readFully(this.data); + this.hash = new byte[input.readInt()]; + input.readFully(this.hash); + this.secret = new byte[input.readInt()]; + input.readFully(this.secret); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.data.length); + output.write(this.data); + output.writeInt(this.hash.length); + output.write(this.hash); + output.writeInt(this.secret.length); + output.write(this.secret); + } } public static class EncryptedPassportElement extends Object { @@ -3536,8 +9750,9 @@ public class TdApi { public String value; public String hash; - public EncryptedPassportElement() { - } + public static final int CONSTRUCTOR = 2002386193; + + public EncryptedPassportElement() {} public EncryptedPassportElement(PassportElementType type, byte[] data, DatedFile frontSide, DatedFile reverseSide, DatedFile selfie, DatedFile[] translation, DatedFile[] files, String value, String hash) { this.type = type; @@ -3551,32 +9766,195 @@ public class TdApi { this.hash = hash; } - public static final int CONSTRUCTOR = 2002386193; + public EncryptedPassportElement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.type = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.type = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.type = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.type = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.type = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.type = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.type = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.type = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.type = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.type = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.type = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.type = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.type = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.data = new byte[input.readInt()]; + input.readFully(this.data); + if (input.readBoolean()) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.frontSide = new DatedFile(input); + } + if (input.readBoolean()) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.reverseSide = new DatedFile(input); + } + if (input.readBoolean()) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.selfie = new DatedFile(input); + } + this.translation = new DatedFile[input.readInt()]; + for (int i = 0; i < this.translation.length; i++) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.translation[i] = new DatedFile(input); + } + this.files = new DatedFile[input.readInt()]; + for (int i = 0; i < this.files.length; i++) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.files[i] = new DatedFile(input); + } + if (input.readBoolean()) { + var valueTmp = new byte[input.readInt()]; + input.readFully(valueTmp); + this.value = new String(valueTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var hashTmp = new byte[input.readInt()]; + input.readFully(hashTmp); + this.hash = new String(hashTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeInt(this.data.length); + output.write(this.data); + if (this.frontSide == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.frontSide.serialize(output); + } + if (this.reverseSide == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.reverseSide.serialize(output); + } + if (this.selfie == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.selfie.serialize(output); + } + output.writeInt(this.translation.length); + for (int i = 0; i < this.translation.length; i++) { + this.translation[i].serialize(output); + } + output.writeInt(this.files.length); + for (int i = 0; i < this.files.length; i++) { + this.files[i].serialize(output); + } + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var valueTmp = this.value.getBytes(StandardCharsets.UTF_8); + output.writeInt(valueTmp.length); + output.write(valueTmp); + } + if (this.hash == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var hashTmp = this.hash.getBytes(StandardCharsets.UTF_8); + output.writeInt(hashTmp.length); + output.write(hashTmp); + } + } } public static class Error extends Object { public int code; public String message; - public Error() { - } + public static final int CONSTRUCTOR = -1679978726; + + public Error() {} public Error(int code, String message) { this.code = code; this.message = message; } - public static final int CONSTRUCTOR = -1679978726; + public Error(DataInputStream input) throws IOException { + this.code = input.readInt(); + if (input.readBoolean()) { + var messageTmp = new byte[input.readInt()]; + input.readFully(messageTmp); + this.message = new String(messageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.code); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var messageTmp = this.message.getBytes(StandardCharsets.UTF_8); + output.writeInt(messageTmp.length); + output.write(messageTmp); + } + } } public static class File extends Object { @@ -3586,8 +9964,9 @@ public class TdApi { public LocalFile local; public RemoteFile remote; - public File() { - } + public static final int CONSTRUCTOR = 766337656; + + public File() {} public File(int id, int size, int expectedSize, LocalFile local, RemoteFile remote) { this.id = id; @@ -3597,281 +9976,448 @@ public class TdApi { this.remote = remote; } - public static final int CONSTRUCTOR = 766337656; + public File(DataInputStream input) throws IOException { + this.id = input.readInt(); + this.size = input.readInt(); + this.expectedSize = input.readInt(); + if (input.readBoolean()) { + if (LocalFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.local = new LocalFile(input); + } + if (input.readBoolean()) { + if (RemoteFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.remote = new RemoteFile(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + output.writeInt(this.size); + output.writeInt(this.expectedSize); + if (this.local == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.local.serialize(output); + } + if (this.remote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.remote.serialize(output); + } + } } public static class FilePart extends Object { public byte[] data; - public FilePart() { - } + public static final int CONSTRUCTOR = 911821878; + + public FilePart() {} public FilePart(byte[] data) { this.data = data; } - public static final int CONSTRUCTOR = 911821878; + public FilePart(DataInputStream input) throws IOException { + this.data = new byte[input.readInt()]; + input.readFully(this.data); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class FileType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.data.length); + output.write(this.data); + } } public static class FileTypeNone extends FileType { - - public FileTypeNone() { - } - public static final int CONSTRUCTOR = 2003009189; - @Override + public FileTypeNone() {} + + + public FileTypeNone(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeAnimation extends FileType { - - public FileTypeAnimation() { - } - public static final int CONSTRUCTOR = -290816582; - @Override + public FileTypeAnimation() {} + + + public FileTypeAnimation(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeAudio extends FileType { - - public FileTypeAudio() { - } - public static final int CONSTRUCTOR = -709112160; - @Override + public FileTypeAudio() {} + + + public FileTypeAudio(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeDocument extends FileType { - - public FileTypeDocument() { - } - public static final int CONSTRUCTOR = -564722929; - @Override + public FileTypeDocument() {} + + + public FileTypeDocument(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypePhoto extends FileType { - - public FileTypePhoto() { - } - public static final int CONSTRUCTOR = -1718914651; - @Override + public FileTypePhoto() {} + + + public FileTypePhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeProfilePhoto extends FileType { - - public FileTypeProfilePhoto() { - } - public static final int CONSTRUCTOR = 1795089315; - @Override + public FileTypeProfilePhoto() {} + + + public FileTypeProfilePhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeSecret extends FileType { - - public FileTypeSecret() { - } - public static final int CONSTRUCTOR = -1871899401; - @Override + public FileTypeSecret() {} + + + public FileTypeSecret(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeSecretThumbnail extends FileType { - - public FileTypeSecretThumbnail() { - } - public static final int CONSTRUCTOR = -1401326026; - @Override + public FileTypeSecretThumbnail() {} + + + public FileTypeSecretThumbnail(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeSecure extends FileType { - - public FileTypeSecure() { - } - public static final int CONSTRUCTOR = -1419133146; - @Override + public FileTypeSecure() {} + + + public FileTypeSecure(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeSticker extends FileType { - - public FileTypeSticker() { - } - public static final int CONSTRUCTOR = 475233385; - @Override + public FileTypeSticker() {} + + + public FileTypeSticker(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeThumbnail extends FileType { - - public FileTypeThumbnail() { - } - public static final int CONSTRUCTOR = -12443298; - @Override + public FileTypeThumbnail() {} + + + public FileTypeThumbnail(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeUnknown extends FileType { - - public FileTypeUnknown() { - } - public static final int CONSTRUCTOR = -2011566768; - @Override + public FileTypeUnknown() {} + + + public FileTypeUnknown(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeVideo extends FileType { - - public FileTypeVideo() { - } - public static final int CONSTRUCTOR = 1430816539; - @Override + public FileTypeVideo() {} + + + public FileTypeVideo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeVideoNote extends FileType { - - public FileTypeVideoNote() { - } - public static final int CONSTRUCTOR = -518412385; - @Override + public FileTypeVideoNote() {} + + + public FileTypeVideoNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeVoiceNote extends FileType { - - public FileTypeVoiceNote() { - } - public static final int CONSTRUCTOR = -588681661; - @Override + public FileTypeVoiceNote() {} + + + public FileTypeVoiceNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FileTypeWallpaper extends FileType { - - public FileTypeWallpaper() { - } - public static final int CONSTRUCTOR = 1854930076; - @Override + public FileTypeWallpaper() {} + + + public FileTypeWallpaper(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class FormattedText extends Object { public String text; public TextEntity[] entities; - public FormattedText() { - } + public static final int CONSTRUCTOR = -252624564; + + public FormattedText() {} public FormattedText(String text, TextEntity[] entities) { this.text = text; this.entities = entities; } - public static final int CONSTRUCTOR = -252624564; + public FormattedText(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + this.entities = new TextEntity[input.readInt()]; + for (int i = 0; i < this.entities.length; i++) { + if (TextEntity.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.entities[i] = new TextEntity(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + output.writeInt(this.entities.length); + for (int i = 0; i < this.entities.length; i++) { + this.entities[i].serialize(output); + } + } } public static class FoundMessages extends Object { public Message[] messages; public long nextFromSearchId; - public FoundMessages() { - } + public static final int CONSTRUCTOR = 2135623881; + + public FoundMessages() {} public FoundMessages(Message[] messages, long nextFromSearchId) { this.messages = messages; this.nextFromSearchId = nextFromSearchId; } - public static final int CONSTRUCTOR = 2135623881; + public FoundMessages(DataInputStream input) throws IOException { + this.messages = new Message[input.readInt()]; + for (int i = 0; i < this.messages.length; i++) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.messages[i] = new Message(input); + } + this.nextFromSearchId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.messages.length); + for (int i = 0; i < this.messages.length; i++) { + this.messages[i].serialize(output); + } + output.writeLong(this.nextFromSearchId); + } } public static class Game extends Object { @@ -3883,8 +10429,9 @@ public class TdApi { public Photo photo; public Animation animation; - public Game() { - } + public static final int CONSTRUCTOR = -1565597752; + + public Game() {} public Game(long id, String shortName, String title, FormattedText text, String description, Photo photo, Animation animation) { this.id = id; @@ -3896,12 +10443,93 @@ public class TdApi { this.animation = animation; } - public static final int CONSTRUCTOR = -1565597752; + public Game(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var shortNameTmp = new byte[input.readInt()]; + input.readFully(shortNameTmp); + this.shortName = new String(shortNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new Animation(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.shortName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var shortNameTmp = this.shortName.getBytes(StandardCharsets.UTF_8); + output.writeInt(shortNameTmp.length); + output.write(shortNameTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + } } public static class GameHighScore extends Object { @@ -3909,8 +10537,9 @@ public class TdApi { public int userId; public int score; - public GameHighScore() { - } + public static final int CONSTRUCTOR = -30778358; + + public GameHighScore() {} public GameHighScore(int position, int userId, int score) { this.position = position; @@ -3918,66 +10547,127 @@ public class TdApi { this.score = score; } - public static final int CONSTRUCTOR = -30778358; + public GameHighScore(DataInputStream input) throws IOException { + this.position = input.readInt(); + this.userId = input.readInt(); + this.score = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.position); + output.writeInt(this.userId); + output.writeInt(this.score); + } } public static class GameHighScores extends Object { public GameHighScore[] scores; - public GameHighScores() { - } + public static final int CONSTRUCTOR = -725770727; + + public GameHighScores() {} public GameHighScores(GameHighScore[] scores) { this.scores = scores; } - public static final int CONSTRUCTOR = -725770727; + public GameHighScores(DataInputStream input) throws IOException { + this.scores = new GameHighScore[input.readInt()]; + for (int i = 0; i < this.scores.length; i++) { + if (GameHighScore.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.scores[i] = new GameHighScore(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.scores.length); + for (int i = 0; i < this.scores.length; i++) { + this.scores[i].serialize(output); + } + } } public static class Hashtags extends Object { public String[] hashtags; - public Hashtags() { - } + public static final int CONSTRUCTOR = 676798885; + + public Hashtags() {} public Hashtags(String[] hashtags) { this.hashtags = hashtags; } - public static final int CONSTRUCTOR = 676798885; + public Hashtags(DataInputStream input) throws IOException { + this.hashtags = new String[input.readInt()]; + for (int i = 0; i < this.hashtags.length; i++) { + var hashtagsTmp = new byte[input.readInt()]; + input.readFully(hashtagsTmp); + this.hashtags[i] = new String(hashtagsTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.hashtags.length); + for (int i = 0; i < this.hashtags.length; i++) { + var hashtagsTmp = this.hashtags[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(hashtagsTmp.length); + output.write(hashtagsTmp); + } + } } public static class HttpUrl extends Object { public String url; - public HttpUrl() { - } + public static final int CONSTRUCTOR = -2018019930; + + public HttpUrl() {} public HttpUrl(String url) { this.url = url; } - public static final int CONSTRUCTOR = -2018019930; + public HttpUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class IdentityDocument extends Object { @@ -3988,8 +10678,9 @@ public class TdApi { public DatedFile selfie; public DatedFile[] translation; - public IdentityDocument() { - } + public static final int CONSTRUCTOR = 445952972; + + public IdentityDocument() {} public IdentityDocument(String number, Date expiryDate, DatedFile frontSide, DatedFile reverseSide, DatedFile selfie, DatedFile[] translation) { this.number = number; @@ -4000,73 +10691,233 @@ public class TdApi { this.translation = translation; } - public static final int CONSTRUCTOR = 445952972; + public IdentityDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var numberTmp = new byte[input.readInt()]; + input.readFully(numberTmp); + this.number = new String(numberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Date.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.expiryDate = new Date(input); + } + if (input.readBoolean()) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.frontSide = new DatedFile(input); + } + if (input.readBoolean()) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.reverseSide = new DatedFile(input); + } + if (input.readBoolean()) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.selfie = new DatedFile(input); + } + this.translation = new DatedFile[input.readInt()]; + for (int i = 0; i < this.translation.length; i++) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.translation[i] = new DatedFile(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.number == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var numberTmp = this.number.getBytes(StandardCharsets.UTF_8); + output.writeInt(numberTmp.length); + output.write(numberTmp); + } + if (this.expiryDate == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.expiryDate.serialize(output); + } + if (this.frontSide == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.frontSide.serialize(output); + } + if (this.reverseSide == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.reverseSide.serialize(output); + } + if (this.selfie == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.selfie.serialize(output); + } + output.writeInt(this.translation.length); + for (int i = 0; i < this.translation.length; i++) { + this.translation[i].serialize(output); + } + } } public static class ImportedContacts extends Object { public int[] userIds; public int[] importerCount; - public ImportedContacts() { - } + public static final int CONSTRUCTOR = -741685354; + + public ImportedContacts() {} public ImportedContacts(int[] userIds, int[] importerCount) { this.userIds = userIds; this.importerCount = importerCount; } - public static final int CONSTRUCTOR = -741685354; + public ImportedContacts(DataInputStream input) throws IOException { + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + this.importerCount = new int[input.readInt()]; + for (int i = 0; i < this.importerCount.length; i++) { + this.importerCount[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + output.writeInt(this.importerCount.length); + for (int i = 0; i < this.importerCount.length; i++) { + output.writeInt(this.importerCount[i]); + } + } } public static class InlineKeyboardButton extends Object { public String text; public InlineKeyboardButtonType type; - public InlineKeyboardButton() { - } + public static final int CONSTRUCTOR = -372105704; + + public InlineKeyboardButton() {} public InlineKeyboardButton(String text, InlineKeyboardButtonType type) { this.text = text; this.type = type; } - public static final int CONSTRUCTOR = -372105704; + public InlineKeyboardButton(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InlineKeyboardButtonTypeUrl.CONSTRUCTOR: + this.type = new InlineKeyboardButtonTypeUrl(input); + break; + case InlineKeyboardButtonTypeLoginUrl.CONSTRUCTOR: + this.type = new InlineKeyboardButtonTypeLoginUrl(input); + break; + case InlineKeyboardButtonTypeCallback.CONSTRUCTOR: + this.type = new InlineKeyboardButtonTypeCallback(input); + break; + case InlineKeyboardButtonTypeCallbackGame.CONSTRUCTOR: + this.type = new InlineKeyboardButtonTypeCallbackGame(input); + break; + case InlineKeyboardButtonTypeSwitchInline.CONSTRUCTOR: + this.type = new InlineKeyboardButtonTypeSwitchInline(input); + break; + case InlineKeyboardButtonTypeBuy.CONSTRUCTOR: + this.type = new InlineKeyboardButtonTypeBuy(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InlineKeyboardButtonType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class InlineKeyboardButtonTypeUrl extends InlineKeyboardButtonType { public String url; - public InlineKeyboardButtonTypeUrl() { - } + public static final int CONSTRUCTOR = 1130741420; + + public InlineKeyboardButtonTypeUrl() {} public InlineKeyboardButtonTypeUrl(String url) { this.url = url; } - public static final int CONSTRUCTOR = 1130741420; + public InlineKeyboardButtonTypeUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class InlineKeyboardButtonTypeLoginUrl extends InlineKeyboardButtonType { @@ -4074,8 +10925,9 @@ public class TdApi { public int id; public String forwardText; - public InlineKeyboardButtonTypeLoginUrl() { - } + public static final int CONSTRUCTOR = 281435539; + + public InlineKeyboardButtonTypeLoginUrl() {} public InlineKeyboardButtonTypeLoginUrl(String url, int id, String forwardText) { this.url = url; @@ -4083,79 +10935,147 @@ public class TdApi { this.forwardText = forwardText; } - public static final int CONSTRUCTOR = 281435539; + public InlineKeyboardButtonTypeLoginUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.id = input.readInt(); + if (input.readBoolean()) { + var forwardTextTmp = new byte[input.readInt()]; + input.readFully(forwardTextTmp); + this.forwardText = new String(forwardTextTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeInt(this.id); + if (this.forwardText == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var forwardTextTmp = this.forwardText.getBytes(StandardCharsets.UTF_8); + output.writeInt(forwardTextTmp.length); + output.write(forwardTextTmp); + } + } } public static class InlineKeyboardButtonTypeCallback extends InlineKeyboardButtonType { public byte[] data; - public InlineKeyboardButtonTypeCallback() { - } + public static final int CONSTRUCTOR = -1127515139; + + public InlineKeyboardButtonTypeCallback() {} public InlineKeyboardButtonTypeCallback(byte[] data) { this.data = data; } - public static final int CONSTRUCTOR = -1127515139; + public InlineKeyboardButtonTypeCallback(DataInputStream input) throws IOException { + this.data = new byte[input.readInt()]; + input.readFully(this.data); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.data.length); + output.write(this.data); + } } public static class InlineKeyboardButtonTypeCallbackGame extends InlineKeyboardButtonType { - - public InlineKeyboardButtonTypeCallbackGame() { - } - public static final int CONSTRUCTOR = -383429528; - @Override + public InlineKeyboardButtonTypeCallbackGame() {} + + + public InlineKeyboardButtonTypeCallbackGame(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class InlineKeyboardButtonTypeSwitchInline extends InlineKeyboardButtonType { public String query; public boolean inCurrentChat; - public InlineKeyboardButtonTypeSwitchInline() { - } + public static final int CONSTRUCTOR = -2035563307; + + public InlineKeyboardButtonTypeSwitchInline() {} public InlineKeyboardButtonTypeSwitchInline(String query, boolean inCurrentChat) { this.query = query; this.inCurrentChat = inCurrentChat; } - public static final int CONSTRUCTOR = -2035563307; + public InlineKeyboardButtonTypeSwitchInline(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.inCurrentChat = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeBoolean(this.inCurrentChat); + } } public static class InlineKeyboardButtonTypeBuy extends InlineKeyboardButtonType { - - public InlineKeyboardButtonTypeBuy() { - } - public static final int CONSTRUCTOR = 1360739440; - @Override + public InlineKeyboardButtonTypeBuy() {} + + + public InlineKeyboardButtonTypeBuy(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InlineQueryResult extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class InlineQueryResultArticle extends InlineQueryResult { @@ -4166,8 +11086,9 @@ public class TdApi { public String description; public PhotoSize thumbnail; - public InlineQueryResultArticle() { - } + public static final int CONSTRUCTOR = -518366710; + + public InlineQueryResultArticle() {} public InlineQueryResultArticle(String id, String url, boolean hideUrl, String title, String description, PhotoSize thumbnail) { this.id = id; @@ -4178,12 +11099,82 @@ public class TdApi { this.thumbnail = thumbnail; } - public static final int CONSTRUCTOR = -518366710; + public InlineQueryResultArticle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.hideUrl = input.readBoolean(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeBoolean(this.hideUrl); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + } } public static class InlineQueryResultContact extends InlineQueryResult { @@ -4191,8 +11182,9 @@ public class TdApi { public Contact contact; public PhotoSize thumbnail; - public InlineQueryResultContact() { - } + public static final int CONSTRUCTOR = 410081985; + + public InlineQueryResultContact() {} public InlineQueryResultContact(String id, Contact contact, PhotoSize thumbnail) { this.id = id; @@ -4200,12 +11192,53 @@ public class TdApi { this.thumbnail = thumbnail; } - public static final int CONSTRUCTOR = 410081985; + public InlineQueryResultContact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contact = new Contact(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.contact == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.contact.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + } } public static class InlineQueryResultLocation extends InlineQueryResult { @@ -4214,8 +11247,9 @@ public class TdApi { public String title; public PhotoSize thumbnail; - public InlineQueryResultLocation() { - } + public static final int CONSTRUCTOR = -158305341; + + public InlineQueryResultLocation() {} public InlineQueryResultLocation(String id, Location location, String title, PhotoSize thumbnail) { this.id = id; @@ -4224,12 +11258,66 @@ public class TdApi { this.thumbnail = thumbnail; } - public static final int CONSTRUCTOR = -158305341; + public InlineQueryResultLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + } } public static class InlineQueryResultVenue extends InlineQueryResult { @@ -4237,8 +11325,9 @@ public class TdApi { public Venue venue; public PhotoSize thumbnail; - public InlineQueryResultVenue() { - } + public static final int CONSTRUCTOR = -1592932211; + + public InlineQueryResultVenue() {} public InlineQueryResultVenue(String id, Venue venue, PhotoSize thumbnail) { this.id = id; @@ -4246,32 +11335,103 @@ public class TdApi { this.thumbnail = thumbnail; } - public static final int CONSTRUCTOR = -1592932211; + public InlineQueryResultVenue(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Venue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.venue = new Venue(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.venue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.venue.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + } } public static class InlineQueryResultGame extends InlineQueryResult { public String id; public Game game; - public InlineQueryResultGame() { - } + public static final int CONSTRUCTOR = 1706916987; + + public InlineQueryResultGame() {} public InlineQueryResultGame(String id, Game game) { this.id = id; this.game = game; } - public static final int CONSTRUCTOR = 1706916987; + public InlineQueryResultGame(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Game.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.game = new Game(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.game == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.game.serialize(output); + } + } } public static class InlineQueryResultAnimation extends InlineQueryResult { @@ -4279,8 +11439,9 @@ public class TdApi { public Animation animation; public String title; - public InlineQueryResultAnimation() { - } + public static final int CONSTRUCTOR = 2009984267; + + public InlineQueryResultAnimation() {} public InlineQueryResultAnimation(String id, Animation animation, String title) { this.id = id; @@ -4288,32 +11449,104 @@ public class TdApi { this.title = title; } - public static final int CONSTRUCTOR = 2009984267; + public InlineQueryResultAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new Animation(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class InlineQueryResultAudio extends InlineQueryResult { public String id; public Audio audio; - public InlineQueryResultAudio() { - } + public static final int CONSTRUCTOR = 842650360; + + public InlineQueryResultAudio() {} public InlineQueryResultAudio(String id, Audio audio) { this.id = id; this.audio = audio; } - public static final int CONSTRUCTOR = 842650360; + public InlineQueryResultAudio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Audio.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.audio = new Audio(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + } } public static class InlineQueryResultDocument extends InlineQueryResult { @@ -4322,8 +11555,9 @@ public class TdApi { public String title; public String description; - public InlineQueryResultDocument() { - } + public static final int CONSTRUCTOR = -1491268539; + + public InlineQueryResultDocument() {} public InlineQueryResultDocument(String id, Document document, String title, String description) { this.id = id; @@ -4332,12 +11566,67 @@ public class TdApi { this.description = description; } - public static final int CONSTRUCTOR = -1491268539; + public InlineQueryResultDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Document.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new Document(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + } } public static class InlineQueryResultPhoto extends InlineQueryResult { @@ -4346,8 +11635,9 @@ public class TdApi { public String title; public String description; - public InlineQueryResultPhoto() { - } + public static final int CONSTRUCTOR = 1848319440; + + public InlineQueryResultPhoto() {} public InlineQueryResultPhoto(String id, Photo photo, String title, String description) { this.id = id; @@ -4356,32 +11646,117 @@ public class TdApi { this.description = description; } - public static final int CONSTRUCTOR = 1848319440; + public InlineQueryResultPhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + } } public static class InlineQueryResultSticker extends InlineQueryResult { public String id; public Sticker sticker; - public InlineQueryResultSticker() { - } + public static final int CONSTRUCTOR = -1848224245; + + public InlineQueryResultSticker() {} public InlineQueryResultSticker(String id, Sticker sticker) { this.id = id; this.sticker = sticker; } - public static final int CONSTRUCTOR = -1848224245; + public InlineQueryResultSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sticker = new Sticker(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class InlineQueryResultVideo extends InlineQueryResult { @@ -4390,8 +11765,9 @@ public class TdApi { public String title; public String description; - public InlineQueryResultVideo() { - } + public static final int CONSTRUCTOR = -1373158683; + + public InlineQueryResultVideo() {} public InlineQueryResultVideo(String id, Video video, String title, String description) { this.id = id; @@ -4400,12 +11776,67 @@ public class TdApi { this.description = description; } - public static final int CONSTRUCTOR = -1373158683; + public InlineQueryResultVideo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Video.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new Video(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + } } public static class InlineQueryResultVoiceNote extends InlineQueryResult { @@ -4413,8 +11844,9 @@ public class TdApi { public VoiceNote voiceNote; public String title; - public InlineQueryResultVoiceNote() { - } + public static final int CONSTRUCTOR = -1897393105; + + public InlineQueryResultVoiceNote() {} public InlineQueryResultVoiceNote(String id, VoiceNote voiceNote, String title) { this.id = id; @@ -4422,12 +11854,54 @@ public class TdApi { this.title = title; } - public static final int CONSTRUCTOR = -1897393105; + public InlineQueryResultVoiceNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (VoiceNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.voiceNote = new VoiceNote(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.voiceNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voiceNote.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class InlineQueryResults extends Object { @@ -4437,8 +11911,9 @@ public class TdApi { public String switchPmText; public String switchPmParameter; - public InlineQueryResults() { - } + public static final int CONSTRUCTOR = 1000709656; + + public InlineQueryResults() {} public InlineQueryResults(long inlineQueryId, String nextOffset, InlineQueryResult[] results, String switchPmText, String switchPmParameter) { this.inlineQueryId = inlineQueryId; @@ -4448,185 +11923,421 @@ public class TdApi { this.switchPmParameter = switchPmParameter; } - public static final int CONSTRUCTOR = 1000709656; + public InlineQueryResults(DataInputStream input) throws IOException { + this.inlineQueryId = input.readLong(); + if (input.readBoolean()) { + var nextOffsetTmp = new byte[input.readInt()]; + input.readFully(nextOffsetTmp); + this.nextOffset = new String(nextOffsetTmp, StandardCharsets.UTF_8); + } + this.results = new InlineQueryResult[input.readInt()]; + for (int i = 0; i < this.results.length; i++) { + switch(input.readInt()) { + case InlineQueryResultArticle.CONSTRUCTOR: + this.results[i] = new InlineQueryResultArticle(input); + break; + case InlineQueryResultContact.CONSTRUCTOR: + this.results[i] = new InlineQueryResultContact(input); + break; + case InlineQueryResultLocation.CONSTRUCTOR: + this.results[i] = new InlineQueryResultLocation(input); + break; + case InlineQueryResultVenue.CONSTRUCTOR: + this.results[i] = new InlineQueryResultVenue(input); + break; + case InlineQueryResultGame.CONSTRUCTOR: + this.results[i] = new InlineQueryResultGame(input); + break; + case InlineQueryResultAnimation.CONSTRUCTOR: + this.results[i] = new InlineQueryResultAnimation(input); + break; + case InlineQueryResultAudio.CONSTRUCTOR: + this.results[i] = new InlineQueryResultAudio(input); + break; + case InlineQueryResultDocument.CONSTRUCTOR: + this.results[i] = new InlineQueryResultDocument(input); + break; + case InlineQueryResultPhoto.CONSTRUCTOR: + this.results[i] = new InlineQueryResultPhoto(input); + break; + case InlineQueryResultSticker.CONSTRUCTOR: + this.results[i] = new InlineQueryResultSticker(input); + break; + case InlineQueryResultVideo.CONSTRUCTOR: + this.results[i] = new InlineQueryResultVideo(input); + break; + case InlineQueryResultVoiceNote.CONSTRUCTOR: + this.results[i] = new InlineQueryResultVoiceNote(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var switchPmTextTmp = new byte[input.readInt()]; + input.readFully(switchPmTextTmp); + this.switchPmText = new String(switchPmTextTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var switchPmParameterTmp = new byte[input.readInt()]; + input.readFully(switchPmParameterTmp); + this.switchPmParameter = new String(switchPmParameterTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputBackground extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.inlineQueryId); + if (this.nextOffset == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nextOffsetTmp = this.nextOffset.getBytes(StandardCharsets.UTF_8); + output.writeInt(nextOffsetTmp.length); + output.write(nextOffsetTmp); + } + output.writeInt(this.results.length); + for (int i = 0; i < this.results.length; i++) { + this.results[i].serialize(output); + } + if (this.switchPmText == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var switchPmTextTmp = this.switchPmText.getBytes(StandardCharsets.UTF_8); + output.writeInt(switchPmTextTmp.length); + output.write(switchPmTextTmp); + } + if (this.switchPmParameter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var switchPmParameterTmp = this.switchPmParameter.getBytes(StandardCharsets.UTF_8); + output.writeInt(switchPmParameterTmp.length); + output.write(switchPmParameterTmp); + } + } } public static class InputBackgroundLocal extends InputBackground { public InputFile background; - public InputBackgroundLocal() { - } + public static final int CONSTRUCTOR = -1747094364; + + public InputBackgroundLocal() {} public InputBackgroundLocal(InputFile background) { this.background = background; } - public static final int CONSTRUCTOR = -1747094364; + public InputBackgroundLocal(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.background = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.background = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.background = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.background = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.background == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.background.serialize(output); + } + } } public static class InputBackgroundRemote extends InputBackground { public long backgroundId; - public InputBackgroundRemote() { - } + public static final int CONSTRUCTOR = -274976231; + + public InputBackgroundRemote() {} public InputBackgroundRemote(long backgroundId) { this.backgroundId = backgroundId; } - public static final int CONSTRUCTOR = -274976231; + public InputBackgroundRemote(DataInputStream input) throws IOException { + this.backgroundId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputCredentials extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.backgroundId); + } } public static class InputCredentialsSaved extends InputCredentials { public String savedCredentialsId; - public InputCredentialsSaved() { - } + public static final int CONSTRUCTOR = -2034385364; + + public InputCredentialsSaved() {} public InputCredentialsSaved(String savedCredentialsId) { this.savedCredentialsId = savedCredentialsId; } - public static final int CONSTRUCTOR = -2034385364; + public InputCredentialsSaved(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var savedCredentialsIdTmp = new byte[input.readInt()]; + input.readFully(savedCredentialsIdTmp); + this.savedCredentialsId = new String(savedCredentialsIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.savedCredentialsId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var savedCredentialsIdTmp = this.savedCredentialsId.getBytes(StandardCharsets.UTF_8); + output.writeInt(savedCredentialsIdTmp.length); + output.write(savedCredentialsIdTmp); + } + } } public static class InputCredentialsNew extends InputCredentials { public String data; public boolean allowSave; - public InputCredentialsNew() { - } + public static final int CONSTRUCTOR = -829689558; + + public InputCredentialsNew() {} public InputCredentialsNew(String data, boolean allowSave) { this.data = data; this.allowSave = allowSave; } - public static final int CONSTRUCTOR = -829689558; + public InputCredentialsNew(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var dataTmp = new byte[input.readInt()]; + input.readFully(dataTmp); + this.data = new String(dataTmp, StandardCharsets.UTF_8); + } + this.allowSave = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.data == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var dataTmp = this.data.getBytes(StandardCharsets.UTF_8); + output.writeInt(dataTmp.length); + output.write(dataTmp); + } + output.writeBoolean(this.allowSave); + } } public static class InputCredentialsAndroidPay extends InputCredentials { public String data; - public InputCredentialsAndroidPay() { - } + public static final int CONSTRUCTOR = 1979566832; + + public InputCredentialsAndroidPay() {} public InputCredentialsAndroidPay(String data) { this.data = data; } - public static final int CONSTRUCTOR = 1979566832; + public InputCredentialsAndroidPay(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var dataTmp = new byte[input.readInt()]; + input.readFully(dataTmp); + this.data = new String(dataTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.data == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var dataTmp = this.data.getBytes(StandardCharsets.UTF_8); + output.writeInt(dataTmp.length); + output.write(dataTmp); + } + } } public static class InputCredentialsApplePay extends InputCredentials { public String data; - public InputCredentialsApplePay() { - } + public static final int CONSTRUCTOR = -1246570799; + + public InputCredentialsApplePay() {} public InputCredentialsApplePay(String data) { this.data = data; } - public static final int CONSTRUCTOR = -1246570799; + public InputCredentialsApplePay(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var dataTmp = new byte[input.readInt()]; + input.readFully(dataTmp); + this.data = new String(dataTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputFile extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.data == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var dataTmp = this.data.getBytes(StandardCharsets.UTF_8); + output.writeInt(dataTmp.length); + output.write(dataTmp); + } + } } public static class InputFileId extends InputFile { public int id; - public InputFileId() { - } + public static final int CONSTRUCTOR = 1788906253; + + public InputFileId() {} public InputFileId(int id) { this.id = id; } - public static final int CONSTRUCTOR = 1788906253; + public InputFileId(DataInputStream input) throws IOException { + this.id = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + } } public static class InputFileRemote extends InputFile { public String id; - public InputFileRemote() { - } + public static final int CONSTRUCTOR = -107574466; + + public InputFileRemote() {} public InputFileRemote(String id) { this.id = id; } - public static final int CONSTRUCTOR = -107574466; + public InputFileRemote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + } } public static class InputFileLocal extends InputFile { public String path; - public InputFileLocal() { - } + public static final int CONSTRUCTOR = 2056030919; + + public InputFileLocal() {} public InputFileLocal(String path) { this.path = path; } - public static final int CONSTRUCTOR = 2056030919; + public InputFileLocal(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var pathTmp = new byte[input.readInt()]; + input.readFully(pathTmp); + this.path = new String(pathTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.path == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var pathTmp = this.path.getBytes(StandardCharsets.UTF_8); + output.writeInt(pathTmp.length); + output.write(pathTmp); + } + } } public static class InputFileGenerated extends InputFile { @@ -4634,8 +12345,9 @@ public class TdApi { public String conversion; public int expectedSize; - public InputFileGenerated() { - } + public static final int CONSTRUCTOR = -1781351885; + + public InputFileGenerated() {} public InputFileGenerated(String originalPath, String conversion, int expectedSize) { this.originalPath = originalPath; @@ -4643,12 +12355,44 @@ public class TdApi { this.expectedSize = expectedSize; } - public static final int CONSTRUCTOR = -1781351885; + public InputFileGenerated(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var originalPathTmp = new byte[input.readInt()]; + input.readFully(originalPathTmp); + this.originalPath = new String(originalPathTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var conversionTmp = new byte[input.readInt()]; + input.readFully(conversionTmp); + this.conversion = new String(conversionTmp, StandardCharsets.UTF_8); + } + this.expectedSize = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.originalPath == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var originalPathTmp = this.originalPath.getBytes(StandardCharsets.UTF_8); + output.writeInt(originalPathTmp.length); + output.write(originalPathTmp); + } + if (this.conversion == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var conversionTmp = this.conversion.getBytes(StandardCharsets.UTF_8); + output.writeInt(conversionTmp.length); + output.write(conversionTmp); + } + output.writeInt(this.expectedSize); + } } public static class InputIdentityDocument extends Object { @@ -4659,8 +12403,9 @@ public class TdApi { public InputFile selfie; public InputFile[] translation; - public InputIdentityDocument() { - } + public static final int CONSTRUCTOR = -381776063; + + public InputIdentityDocument() {} public InputIdentityDocument(String number, Date expiryDate, InputFile frontSide, InputFile reverseSide, InputFile selfie, InputFile[] translation) { this.number = number; @@ -4671,15 +12416,136 @@ public class TdApi { this.translation = translation; } - public static final int CONSTRUCTOR = -381776063; + public InputIdentityDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var numberTmp = new byte[input.readInt()]; + input.readFully(numberTmp); + this.number = new String(numberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Date.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.expiryDate = new Date(input); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.frontSide = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.frontSide = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.frontSide = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.frontSide = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.reverseSide = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.reverseSide = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.reverseSide = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.reverseSide = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.selfie = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.selfie = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.selfie = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.selfie = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.translation = new InputFile[input.readInt()]; + for (int i = 0; i < this.translation.length; i++) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.translation[i] = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.translation[i] = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.translation[i] = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.translation[i] = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputInlineQueryResult extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.number == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var numberTmp = this.number.getBytes(StandardCharsets.UTF_8); + output.writeInt(numberTmp.length); + output.write(numberTmp); + } + if (this.expiryDate == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.expiryDate.serialize(output); + } + if (this.frontSide == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.frontSide.serialize(output); + } + if (this.reverseSide == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.reverseSide.serialize(output); + } + if (this.selfie == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.selfie.serialize(output); + } + output.writeInt(this.translation.length); + for (int i = 0; i < this.translation.length; i++) { + this.translation[i].serialize(output); + } + } } public static class InputInlineQueryResultAnimatedGif extends InputInlineQueryResult { @@ -4693,8 +12559,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultAnimatedGif() { - } + public static final int CONSTRUCTOR = -891474894; + + public InputInlineQueryResultAnimatedGif() {} public InputInlineQueryResultAnimatedGif(String id, String title, String thumbnailUrl, String gifUrl, int gifDuration, int gifWidth, int gifHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4708,12 +12575,161 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -891474894; + public InputInlineQueryResultAnimatedGif(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var gifUrlTmp = new byte[input.readInt()]; + input.readFully(gifUrlTmp); + this.gifUrl = new String(gifUrlTmp, StandardCharsets.UTF_8); + } + this.gifDuration = input.readInt(); + this.gifWidth = input.readInt(); + this.gifHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + if (this.gifUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var gifUrlTmp = this.gifUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(gifUrlTmp.length); + output.write(gifUrlTmp); + } + output.writeInt(this.gifDuration); + output.writeInt(this.gifWidth); + output.writeInt(this.gifHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultAnimatedMpeg4 extends InputInlineQueryResult { @@ -4727,8 +12743,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultAnimatedMpeg4() { - } + public static final int CONSTRUCTOR = -1629529888; + + public InputInlineQueryResultAnimatedMpeg4() {} public InputInlineQueryResultAnimatedMpeg4(String id, String title, String thumbnailUrl, String mpeg4Url, int mpeg4Duration, int mpeg4Width, int mpeg4Height, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4742,12 +12759,161 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -1629529888; + public InputInlineQueryResultAnimatedMpeg4(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mpeg4UrlTmp = new byte[input.readInt()]; + input.readFully(mpeg4UrlTmp); + this.mpeg4Url = new String(mpeg4UrlTmp, StandardCharsets.UTF_8); + } + this.mpeg4Duration = input.readInt(); + this.mpeg4Width = input.readInt(); + this.mpeg4Height = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + if (this.mpeg4Url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mpeg4UrlTmp = this.mpeg4Url.getBytes(StandardCharsets.UTF_8); + output.writeInt(mpeg4UrlTmp.length); + output.write(mpeg4UrlTmp); + } + output.writeInt(this.mpeg4Duration); + output.writeInt(this.mpeg4Width); + output.writeInt(this.mpeg4Height); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultArticle extends InputInlineQueryResult { @@ -4762,8 +12928,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultArticle() { - } + public static final int CONSTRUCTOR = 1973670156; + + public InputInlineQueryResultArticle() {} public InputInlineQueryResultArticle(String id, String url, boolean hideUrl, String title, String description, String thumbnailUrl, int thumbnailWidth, int thumbnailHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4778,12 +12945,174 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 1973670156; + public InputInlineQueryResultArticle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.hideUrl = input.readBoolean(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + this.thumbnailWidth = input.readInt(); + this.thumbnailHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeBoolean(this.hideUrl); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + output.writeInt(this.thumbnailWidth); + output.writeInt(this.thumbnailHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultAudio extends InputInlineQueryResult { @@ -4795,8 +13124,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultAudio() { - } + public static final int CONSTRUCTOR = 1260139988; + + public InputInlineQueryResultAudio() {} public InputInlineQueryResultAudio(String id, String title, String performer, String audioUrl, int audioDuration, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4808,12 +13138,157 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 1260139988; + public InputInlineQueryResultAudio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var performerTmp = new byte[input.readInt()]; + input.readFully(performerTmp); + this.performer = new String(performerTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var audioUrlTmp = new byte[input.readInt()]; + input.readFully(audioUrlTmp); + this.audioUrl = new String(audioUrlTmp, StandardCharsets.UTF_8); + } + this.audioDuration = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.performer == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var performerTmp = this.performer.getBytes(StandardCharsets.UTF_8); + output.writeInt(performerTmp.length); + output.write(performerTmp); + } + if (this.audioUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var audioUrlTmp = this.audioUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(audioUrlTmp.length); + output.write(audioUrlTmp); + } + output.writeInt(this.audioDuration); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultContact extends InputInlineQueryResult { @@ -4825,8 +13300,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultContact() { - } + public static final int CONSTRUCTOR = 1846064594; + + public InputInlineQueryResultContact() {} public InputInlineQueryResultContact(String id, Contact contact, String thumbnailUrl, int thumbnailWidth, int thumbnailHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4838,12 +13314,145 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 1846064594; + public InputInlineQueryResultContact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contact = new Contact(input); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + this.thumbnailWidth = input.readInt(); + this.thumbnailHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.contact == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.contact.serialize(output); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + output.writeInt(this.thumbnailWidth); + output.writeInt(this.thumbnailHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultDocument extends InputInlineQueryResult { @@ -4858,8 +13467,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultDocument() { - } + public static final int CONSTRUCTOR = 578801869; + + public InputInlineQueryResultDocument() {} public InputInlineQueryResultDocument(String id, String title, String description, String documentUrl, String mimeType, String thumbnailUrl, int thumbnailWidth, int thumbnailHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4874,12 +13484,185 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 578801869; + public InputInlineQueryResultDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var documentUrlTmp = new byte[input.readInt()]; + input.readFully(documentUrlTmp); + this.documentUrl = new String(documentUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + this.thumbnailWidth = input.readInt(); + this.thumbnailHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.documentUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var documentUrlTmp = this.documentUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(documentUrlTmp.length); + output.write(documentUrlTmp); + } + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + output.writeInt(this.thumbnailWidth); + output.writeInt(this.thumbnailHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultGame extends InputInlineQueryResult { @@ -4887,8 +13670,9 @@ public class TdApi { public String gameShortName; public ReplyMarkup replyMarkup; - public InputInlineQueryResultGame() { - } + public static final int CONSTRUCTOR = 966074327; + + public InputInlineQueryResultGame() {} public InputInlineQueryResultGame(String id, String gameShortName, ReplyMarkup replyMarkup) { this.id = id; @@ -4896,12 +13680,66 @@ public class TdApi { this.replyMarkup = replyMarkup; } - public static final int CONSTRUCTOR = 966074327; + public InputInlineQueryResultGame(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var gameShortNameTmp = new byte[input.readInt()]; + input.readFully(gameShortNameTmp); + this.gameShortName = new String(gameShortNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.gameShortName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var gameShortNameTmp = this.gameShortName.getBytes(StandardCharsets.UTF_8); + output.writeInt(gameShortNameTmp.length); + output.write(gameShortNameTmp); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + } } public static class InputInlineQueryResultLocation extends InputInlineQueryResult { @@ -4915,8 +13753,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultLocation() { - } + public static final int CONSTRUCTOR = -1887650218; + + public InputInlineQueryResultLocation() {} public InputInlineQueryResultLocation(String id, Location location, int livePeriod, String title, String thumbnailUrl, int thumbnailWidth, int thumbnailHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4930,12 +13769,160 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -1887650218; + public InputInlineQueryResultLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + this.livePeriod = input.readInt(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + this.thumbnailWidth = input.readInt(); + this.thumbnailHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + output.writeInt(this.livePeriod); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + output.writeInt(this.thumbnailWidth); + output.writeInt(this.thumbnailHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultPhoto extends InputInlineQueryResult { @@ -4949,8 +13936,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultPhoto() { - } + public static final int CONSTRUCTOR = -1123338721; + + public InputInlineQueryResultPhoto() {} public InputInlineQueryResultPhoto(String id, String title, String description, String thumbnailUrl, String photoUrl, int photoWidth, int photoHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4964,12 +13952,172 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -1123338721; + public InputInlineQueryResultPhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var photoUrlTmp = new byte[input.readInt()]; + input.readFully(photoUrlTmp); + this.photoUrl = new String(photoUrlTmp, StandardCharsets.UTF_8); + } + this.photoWidth = input.readInt(); + this.photoHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + if (this.photoUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var photoUrlTmp = this.photoUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(photoUrlTmp.length); + output.write(photoUrlTmp); + } + output.writeInt(this.photoWidth); + output.writeInt(this.photoHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultSticker extends InputInlineQueryResult { @@ -4981,8 +14129,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultSticker() { - } + public static final int CONSTRUCTOR = 274007129; + + public InputInlineQueryResultSticker() {} public InputInlineQueryResultSticker(String id, String thumbnailUrl, String stickerUrl, int stickerWidth, int stickerHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -4994,12 +14143,146 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 274007129; + public InputInlineQueryResultSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var stickerUrlTmp = new byte[input.readInt()]; + input.readFully(stickerUrlTmp); + this.stickerUrl = new String(stickerUrlTmp, StandardCharsets.UTF_8); + } + this.stickerWidth = input.readInt(); + this.stickerHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + if (this.stickerUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var stickerUrlTmp = this.stickerUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(stickerUrlTmp.length); + output.write(stickerUrlTmp); + } + output.writeInt(this.stickerWidth); + output.writeInt(this.stickerHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultVenue extends InputInlineQueryResult { @@ -5011,8 +14294,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultVenue() { - } + public static final int CONSTRUCTOR = 541704509; + + public InputInlineQueryResultVenue() {} public InputInlineQueryResultVenue(String id, Venue venue, String thumbnailUrl, int thumbnailWidth, int thumbnailHeight, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -5024,12 +14308,145 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 541704509; + public InputInlineQueryResultVenue(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Venue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.venue = new Venue(input); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + this.thumbnailWidth = input.readInt(); + this.thumbnailHeight = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.venue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.venue.serialize(output); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + output.writeInt(this.thumbnailWidth); + output.writeInt(this.thumbnailHeight); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultVideo extends InputInlineQueryResult { @@ -5045,8 +14462,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultVideo() { - } + public static final int CONSTRUCTOR = 1724073191; + + public InputInlineQueryResultVideo() {} public InputInlineQueryResultVideo(String id, String title, String description, String thumbnailUrl, String videoUrl, String mimeType, int videoWidth, int videoHeight, int videoDuration, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -5062,12 +14480,187 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 1724073191; + public InputInlineQueryResultVideo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var thumbnailUrlTmp = new byte[input.readInt()]; + input.readFully(thumbnailUrlTmp); + this.thumbnailUrl = new String(thumbnailUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var videoUrlTmp = new byte[input.readInt()]; + input.readFully(videoUrlTmp); + this.videoUrl = new String(videoUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + this.videoWidth = input.readInt(); + this.videoHeight = input.readInt(); + this.videoDuration = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.thumbnailUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var thumbnailUrlTmp = this.thumbnailUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(thumbnailUrlTmp.length); + output.write(thumbnailUrlTmp); + } + if (this.videoUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var videoUrlTmp = this.videoUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(videoUrlTmp.length); + output.write(videoUrlTmp); + } + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + output.writeInt(this.videoWidth); + output.writeInt(this.videoHeight); + output.writeInt(this.videoDuration); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputInlineQueryResultVoiceNote extends InputInlineQueryResult { @@ -5078,8 +14671,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public InputInlineQueryResultVoiceNote() { - } + public static final int CONSTRUCTOR = -1790072503; + + public InputInlineQueryResultVoiceNote() {} public InputInlineQueryResultVoiceNote(String id, String title, String voiceNoteUrl, int voiceNoteDuration, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.id = id; @@ -5090,15 +14684,144 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -1790072503; + public InputInlineQueryResultVoiceNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var voiceNoteUrlTmp = new byte[input.readInt()]; + input.readFully(voiceNoteUrlTmp); + this.voiceNoteUrl = new String(voiceNoteUrlTmp, StandardCharsets.UTF_8); + } + this.voiceNoteDuration = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputMessageContent extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.voiceNoteUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var voiceNoteUrlTmp = this.voiceNoteUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(voiceNoteUrlTmp.length); + output.write(voiceNoteUrlTmp); + } + output.writeInt(this.voiceNoteDuration); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class InputMessageText extends InputMessageContent { @@ -5106,8 +14829,9 @@ public class TdApi { public boolean disableWebPagePreview; public boolean clearDraft; - public InputMessageText() { - } + public static final int CONSTRUCTOR = 247050392; + + public InputMessageText() {} public InputMessageText(FormattedText text, boolean disableWebPagePreview, boolean clearDraft) { this.text = text; @@ -5115,12 +14839,32 @@ public class TdApi { this.clearDraft = clearDraft; } - public static final int CONSTRUCTOR = 247050392; + public InputMessageText(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + this.disableWebPagePreview = input.readBoolean(); + this.clearDraft = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + output.writeBoolean(this.disableWebPagePreview); + output.writeBoolean(this.clearDraft); + } } public static class InputMessageAnimation extends InputMessageContent { @@ -5131,8 +14875,9 @@ public class TdApi { public int height; public FormattedText caption; - public InputMessageAnimation() { - } + public static final int CONSTRUCTOR = 926542724; + + public InputMessageAnimation() {} public InputMessageAnimation(InputFile animation, InputThumbnail thumbnail, int duration, int width, int height, FormattedText caption) { this.animation = animation; @@ -5143,12 +14888,70 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = 926542724; + public InputMessageAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.animation = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.animation = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.animation = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.animation = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new InputThumbnail(input); + } + this.duration = input.readInt(); + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeInt(this.duration); + output.writeInt(this.width); + output.writeInt(this.height); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class InputMessageAudio extends InputMessageContent { @@ -5159,8 +14962,9 @@ public class TdApi { public String performer; public FormattedText caption; - public InputMessageAudio() { - } + public static final int CONSTRUCTOR = -626786126; + + public InputMessageAudio() {} public InputMessageAudio(InputFile audio, InputThumbnail albumCoverThumbnail, int duration, String title, String performer, FormattedText caption) { this.audio = audio; @@ -5171,12 +14975,92 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = -626786126; + public InputMessageAudio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.audio = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.audio = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.audio = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.audio = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.albumCoverThumbnail = new InputThumbnail(input); + } + this.duration = input.readInt(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var performerTmp = new byte[input.readInt()]; + input.readFully(performerTmp); + this.performer = new String(performerTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + if (this.albumCoverThumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.albumCoverThumbnail.serialize(output); + } + output.writeInt(this.duration); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.performer == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var performerTmp = this.performer.getBytes(StandardCharsets.UTF_8); + output.writeInt(performerTmp.length); + output.write(performerTmp); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class InputMessageDocument extends InputMessageContent { @@ -5184,8 +15068,9 @@ public class TdApi { public InputThumbnail thumbnail; public FormattedText caption; - public InputMessageDocument() { - } + public static final int CONSTRUCTOR = 937970604; + + public InputMessageDocument() {} public InputMessageDocument(InputFile document, InputThumbnail thumbnail, FormattedText caption) { this.document = document; @@ -5193,12 +15078,64 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = 937970604; + public InputMessageDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.document = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.document = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.document = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.document = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new InputThumbnail(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class InputMessagePhoto extends InputMessageContent { @@ -5210,8 +15147,9 @@ public class TdApi { public FormattedText caption; public int ttl; - public InputMessagePhoto() { - } + public static final int CONSTRUCTOR = 1648801584; + + public InputMessagePhoto() {} public InputMessagePhoto(InputFile photo, InputThumbnail thumbnail, int[] addedStickerFileIds, int width, int height, FormattedText caption, int ttl) { this.photo = photo; @@ -5223,12 +15161,78 @@ public class TdApi { this.ttl = ttl; } - public static final int CONSTRUCTOR = 1648801584; + public InputMessagePhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.photo = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.photo = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.photo = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.photo = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new InputThumbnail(input); + } + this.addedStickerFileIds = new int[input.readInt()]; + for (int i = 0; i < this.addedStickerFileIds.length; i++) { + this.addedStickerFileIds[i] = input.readInt(); + } + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + this.ttl = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeInt(this.addedStickerFileIds.length); + for (int i = 0; i < this.addedStickerFileIds.length; i++) { + output.writeInt(this.addedStickerFileIds[i]); + } + output.writeInt(this.width); + output.writeInt(this.height); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeInt(this.ttl); + } } public static class InputMessageSticker extends InputMessageContent { @@ -5237,8 +15241,9 @@ public class TdApi { public int width; public int height; - public InputMessageSticker() { - } + public static final int CONSTRUCTOR = 740776325; + + public InputMessageSticker() {} public InputMessageSticker(InputFile sticker, InputThumbnail thumbnail, int width, int height) { this.sticker = sticker; @@ -5247,12 +15252,56 @@ public class TdApi { this.height = height; } - public static final int CONSTRUCTOR = 740776325; + public InputMessageSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new InputThumbnail(input); + } + this.width = input.readInt(); + this.height = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeInt(this.width); + output.writeInt(this.height); + } } public static class InputMessageVideo extends InputMessageContent { @@ -5266,8 +15315,9 @@ public class TdApi { public FormattedText caption; public int ttl; - public InputMessageVideo() { - } + public static final int CONSTRUCTOR = -2108486755; + + public InputMessageVideo() {} public InputMessageVideo(InputFile video, InputThumbnail thumbnail, int[] addedStickerFileIds, int duration, int width, int height, boolean supportsStreaming, FormattedText caption, int ttl) { this.video = video; @@ -5281,12 +15331,82 @@ public class TdApi { this.ttl = ttl; } - public static final int CONSTRUCTOR = -2108486755; + public InputMessageVideo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.video = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.video = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.video = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.video = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new InputThumbnail(input); + } + this.addedStickerFileIds = new int[input.readInt()]; + for (int i = 0; i < this.addedStickerFileIds.length; i++) { + this.addedStickerFileIds[i] = input.readInt(); + } + this.duration = input.readInt(); + this.width = input.readInt(); + this.height = input.readInt(); + this.supportsStreaming = input.readBoolean(); + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + this.ttl = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeInt(this.addedStickerFileIds.length); + for (int i = 0; i < this.addedStickerFileIds.length; i++) { + output.writeInt(this.addedStickerFileIds[i]); + } + output.writeInt(this.duration); + output.writeInt(this.width); + output.writeInt(this.height); + output.writeBoolean(this.supportsStreaming); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeInt(this.ttl); + } } public static class InputMessageVideoNote extends InputMessageContent { @@ -5295,8 +15415,9 @@ public class TdApi { public int duration; public int length; - public InputMessageVideoNote() { - } + public static final int CONSTRUCTOR = 279108859; + + public InputMessageVideoNote() {} public InputMessageVideoNote(InputFile videoNote, InputThumbnail thumbnail, int duration, int length) { this.videoNote = videoNote; @@ -5305,12 +15426,56 @@ public class TdApi { this.length = length; } - public static final int CONSTRUCTOR = 279108859; + public InputMessageVideoNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.videoNote = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.videoNote = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.videoNote = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.videoNote = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (InputThumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new InputThumbnail(input); + } + this.duration = input.readInt(); + this.length = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.videoNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.videoNote.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeInt(this.duration); + output.writeInt(this.length); + } } public static class InputMessageVoiceNote extends InputMessageContent { @@ -5319,8 +15484,9 @@ public class TdApi { public byte[] waveform; public FormattedText caption; - public InputMessageVoiceNote() { - } + public static final int CONSTRUCTOR = 2136519657; + + public InputMessageVoiceNote() {} public InputMessageVoiceNote(InputFile voiceNote, int duration, byte[] waveform, FormattedText caption) { this.voiceNote = voiceNote; @@ -5329,108 +15495,247 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = 2136519657; + public InputMessageVoiceNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.voiceNote = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.voiceNote = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.voiceNote = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.voiceNote = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.duration = input.readInt(); + this.waveform = new byte[input.readInt()]; + input.readFully(this.waveform); + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.voiceNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voiceNote.serialize(output); + } + output.writeInt(this.duration); + output.writeInt(this.waveform.length); + output.write(this.waveform); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class InputMessageLocation extends InputMessageContent { public Location location; public int livePeriod; - public InputMessageLocation() { - } + public static final int CONSTRUCTOR = -1624179655; + + public InputMessageLocation() {} public InputMessageLocation(Location location, int livePeriod) { this.location = location; this.livePeriod = livePeriod; } - public static final int CONSTRUCTOR = -1624179655; + public InputMessageLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + this.livePeriod = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + output.writeInt(this.livePeriod); + } } public static class InputMessageVenue extends InputMessageContent { public Venue venue; - public InputMessageVenue() { - } + public static final int CONSTRUCTOR = 1447926269; + + public InputMessageVenue() {} public InputMessageVenue(Venue venue) { this.venue = venue; } - public static final int CONSTRUCTOR = 1447926269; + public InputMessageVenue(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Venue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.venue = new Venue(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.venue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.venue.serialize(output); + } + } } public static class InputMessageContact extends InputMessageContent { public Contact contact; - public InputMessageContact() { - } + public static final int CONSTRUCTOR = -982446849; + + public InputMessageContact() {} public InputMessageContact(Contact contact) { this.contact = contact; } - public static final int CONSTRUCTOR = -982446849; + public InputMessageContact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contact = new Contact(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.contact == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.contact.serialize(output); + } + } } public static class InputMessageDice extends InputMessageContent { public String emoji; public boolean clearDraft; - public InputMessageDice() { - } + public static final int CONSTRUCTOR = 841574313; + + public InputMessageDice() {} public InputMessageDice(String emoji, boolean clearDraft) { this.emoji = emoji; this.clearDraft = clearDraft; } - public static final int CONSTRUCTOR = 841574313; + public InputMessageDice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emojiTmp = new byte[input.readInt()]; + input.readFully(emojiTmp); + this.emoji = new String(emojiTmp, StandardCharsets.UTF_8); + } + this.clearDraft = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emoji == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojiTmp = this.emoji.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojiTmp.length); + output.write(emojiTmp); + } + output.writeBoolean(this.clearDraft); + } } public static class InputMessageGame extends InputMessageContent { public int botUserId; public String gameShortName; - public InputMessageGame() { - } + public static final int CONSTRUCTOR = -1728000914; + + public InputMessageGame() {} public InputMessageGame(int botUserId, String gameShortName) { this.botUserId = botUserId; this.gameShortName = gameShortName; } - public static final int CONSTRUCTOR = -1728000914; + public InputMessageGame(DataInputStream input) throws IOException { + this.botUserId = input.readInt(); + if (input.readBoolean()) { + var gameShortNameTmp = new byte[input.readInt()]; + input.readFully(gameShortNameTmp); + this.gameShortName = new String(gameShortNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.botUserId); + if (this.gameShortName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var gameShortNameTmp = this.gameShortName.getBytes(StandardCharsets.UTF_8); + output.writeInt(gameShortNameTmp.length); + output.write(gameShortNameTmp); + } + } } public static class InputMessageInvoice extends InputMessageContent { @@ -5446,8 +15751,9 @@ public class TdApi { public String providerData; public String startParameter; - public InputMessageInvoice() { - } + public static final int CONSTRUCTOR = 1038812175; + + public InputMessageInvoice() {} public InputMessageInvoice(Invoice invoice, String title, String description, String photoUrl, int photoSize, int photoWidth, int photoHeight, byte[] payload, String providerToken, String providerData, String startParameter) { this.invoice = invoice; @@ -5463,12 +15769,116 @@ public class TdApi { this.startParameter = startParameter; } - public static final int CONSTRUCTOR = 1038812175; + public InputMessageInvoice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Invoice.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.invoice = new Invoice(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var photoUrlTmp = new byte[input.readInt()]; + input.readFully(photoUrlTmp); + this.photoUrl = new String(photoUrlTmp, StandardCharsets.UTF_8); + } + this.photoSize = input.readInt(); + this.photoWidth = input.readInt(); + this.photoHeight = input.readInt(); + this.payload = new byte[input.readInt()]; + input.readFully(this.payload); + if (input.readBoolean()) { + var providerTokenTmp = new byte[input.readInt()]; + input.readFully(providerTokenTmp); + this.providerToken = new String(providerTokenTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var providerDataTmp = new byte[input.readInt()]; + input.readFully(providerDataTmp); + this.providerData = new String(providerDataTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var startParameterTmp = new byte[input.readInt()]; + input.readFully(startParameterTmp); + this.startParameter = new String(startParameterTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.invoice == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.invoice.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.photoUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var photoUrlTmp = this.photoUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(photoUrlTmp.length); + output.write(photoUrlTmp); + } + output.writeInt(this.photoSize); + output.writeInt(this.photoWidth); + output.writeInt(this.photoHeight); + output.writeInt(this.payload.length); + output.write(this.payload); + if (this.providerToken == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var providerTokenTmp = this.providerToken.getBytes(StandardCharsets.UTF_8); + output.writeInt(providerTokenTmp.length); + output.write(providerTokenTmp); + } + if (this.providerData == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var providerDataTmp = this.providerData.getBytes(StandardCharsets.UTF_8); + output.writeInt(providerDataTmp.length); + output.write(providerDataTmp); + } + if (this.startParameter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var startParameterTmp = this.startParameter.getBytes(StandardCharsets.UTF_8); + output.writeInt(startParameterTmp.length); + output.write(startParameterTmp); + } + } } public static class InputMessagePoll extends InputMessageContent { @@ -5480,8 +15890,9 @@ public class TdApi { public int closeDate; public boolean isClosed; - public InputMessagePoll() { - } + public static final int CONSTRUCTOR = 2054629900; + + public InputMessagePoll() {} public InputMessagePoll(String question, String[] options, boolean isAnonymous, PollType type, int openPeriod, int closeDate, boolean isClosed) { this.question = question; @@ -5493,12 +15904,67 @@ public class TdApi { this.isClosed = isClosed; } - public static final int CONSTRUCTOR = 2054629900; + public InputMessagePoll(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var questionTmp = new byte[input.readInt()]; + input.readFully(questionTmp); + this.question = new String(questionTmp, StandardCharsets.UTF_8); + } + this.options = new String[input.readInt()]; + for (int i = 0; i < this.options.length; i++) { + var optionsTmp = new byte[input.readInt()]; + input.readFully(optionsTmp); + this.options[i] = new String(optionsTmp, StandardCharsets.UTF_8); + } + this.isAnonymous = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case PollTypeRegular.CONSTRUCTOR: + this.type = new PollTypeRegular(input); + break; + case PollTypeQuiz.CONSTRUCTOR: + this.type = new PollTypeQuiz(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.openPeriod = input.readInt(); + this.closeDate = input.readInt(); + this.isClosed = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.question == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var questionTmp = this.question.getBytes(StandardCharsets.UTF_8); + output.writeInt(questionTmp.length); + output.write(questionTmp); + } + output.writeInt(this.options.length); + for (int i = 0; i < this.options.length; i++) { + var optionsTmp = this.options[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(optionsTmp.length); + output.write(optionsTmp); + } + output.writeBoolean(this.isAnonymous); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeInt(this.openPeriod); + output.writeInt(this.closeDate); + output.writeBoolean(this.isClosed); + } } public static class InputMessageForwarded extends InputMessageContent { @@ -5508,8 +15974,9 @@ public class TdApi { public boolean sendCopy; public boolean removeCaption; - public InputMessageForwarded() { - } + public static final int CONSTRUCTOR = 1503132333; + + public InputMessageForwarded() {} public InputMessageForwarded(long fromChatId, long messageId, boolean inGameShare, boolean sendCopy, boolean removeCaption) { this.fromChatId = fromChatId; @@ -5519,249 +15986,483 @@ public class TdApi { this.removeCaption = removeCaption; } - public static final int CONSTRUCTOR = 1503132333; + public InputMessageForwarded(DataInputStream input) throws IOException { + this.fromChatId = input.readLong(); + this.messageId = input.readLong(); + this.inGameShare = input.readBoolean(); + this.sendCopy = input.readBoolean(); + this.removeCaption = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputPassportElement extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.fromChatId); + output.writeLong(this.messageId); + output.writeBoolean(this.inGameShare); + output.writeBoolean(this.sendCopy); + output.writeBoolean(this.removeCaption); + } } public static class InputPassportElementPersonalDetails extends InputPassportElement { public PersonalDetails personalDetails; - public InputPassportElementPersonalDetails() { - } + public static final int CONSTRUCTOR = 164791359; + + public InputPassportElementPersonalDetails() {} public InputPassportElementPersonalDetails(PersonalDetails personalDetails) { this.personalDetails = personalDetails; } - public static final int CONSTRUCTOR = 164791359; + public InputPassportElementPersonalDetails(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDetails.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.personalDetails = new PersonalDetails(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.personalDetails == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.personalDetails.serialize(output); + } + } } public static class InputPassportElementPassport extends InputPassportElement { public InputIdentityDocument passport; - public InputPassportElementPassport() { - } + public static final int CONSTRUCTOR = -497011356; + + public InputPassportElementPassport() {} public InputPassportElementPassport(InputIdentityDocument passport) { this.passport = passport; } - public static final int CONSTRUCTOR = -497011356; + public InputPassportElementPassport(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputIdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.passport = new InputIdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.passport == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.passport.serialize(output); + } + } } public static class InputPassportElementDriverLicense extends InputPassportElement { public InputIdentityDocument driverLicense; - public InputPassportElementDriverLicense() { - } + public static final int CONSTRUCTOR = 304813264; + + public InputPassportElementDriverLicense() {} public InputPassportElementDriverLicense(InputIdentityDocument driverLicense) { this.driverLicense = driverLicense; } - public static final int CONSTRUCTOR = 304813264; + public InputPassportElementDriverLicense(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputIdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.driverLicense = new InputIdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.driverLicense == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.driverLicense.serialize(output); + } + } } public static class InputPassportElementIdentityCard extends InputPassportElement { public InputIdentityDocument identityCard; - public InputPassportElementIdentityCard() { - } + public static final int CONSTRUCTOR = -9963390; + + public InputPassportElementIdentityCard() {} public InputPassportElementIdentityCard(InputIdentityDocument identityCard) { this.identityCard = identityCard; } - public static final int CONSTRUCTOR = -9963390; + public InputPassportElementIdentityCard(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputIdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.identityCard = new InputIdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.identityCard == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.identityCard.serialize(output); + } + } } public static class InputPassportElementInternalPassport extends InputPassportElement { public InputIdentityDocument internalPassport; - public InputPassportElementInternalPassport() { - } + public static final int CONSTRUCTOR = 715360043; + + public InputPassportElementInternalPassport() {} public InputPassportElementInternalPassport(InputIdentityDocument internalPassport) { this.internalPassport = internalPassport; } - public static final int CONSTRUCTOR = 715360043; + public InputPassportElementInternalPassport(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputIdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.internalPassport = new InputIdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.internalPassport == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.internalPassport.serialize(output); + } + } } public static class InputPassportElementAddress extends InputPassportElement { public Address address; - public InputPassportElementAddress() { - } + public static final int CONSTRUCTOR = 461630480; + + public InputPassportElementAddress() {} public InputPassportElementAddress(Address address) { this.address = address; } - public static final int CONSTRUCTOR = 461630480; + public InputPassportElementAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Address.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.address = new Address(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.address == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.address.serialize(output); + } + } } public static class InputPassportElementUtilityBill extends InputPassportElement { public InputPersonalDocument utilityBill; - public InputPassportElementUtilityBill() { - } + public static final int CONSTRUCTOR = 1389203841; + + public InputPassportElementUtilityBill() {} public InputPassportElementUtilityBill(InputPersonalDocument utilityBill) { this.utilityBill = utilityBill; } - public static final int CONSTRUCTOR = 1389203841; + public InputPassportElementUtilityBill(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputPersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.utilityBill = new InputPersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.utilityBill == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.utilityBill.serialize(output); + } + } } public static class InputPassportElementBankStatement extends InputPassportElement { public InputPersonalDocument bankStatement; - public InputPassportElementBankStatement() { - } + public static final int CONSTRUCTOR = -26585208; + + public InputPassportElementBankStatement() {} public InputPassportElementBankStatement(InputPersonalDocument bankStatement) { this.bankStatement = bankStatement; } - public static final int CONSTRUCTOR = -26585208; + public InputPassportElementBankStatement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputPersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.bankStatement = new InputPersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.bankStatement == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.bankStatement.serialize(output); + } + } } public static class InputPassportElementRentalAgreement extends InputPassportElement { public InputPersonalDocument rentalAgreement; - public InputPassportElementRentalAgreement() { - } + public static final int CONSTRUCTOR = 1736154155; + + public InputPassportElementRentalAgreement() {} public InputPassportElementRentalAgreement(InputPersonalDocument rentalAgreement) { this.rentalAgreement = rentalAgreement; } - public static final int CONSTRUCTOR = 1736154155; + public InputPassportElementRentalAgreement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputPersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.rentalAgreement = new InputPersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.rentalAgreement == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.rentalAgreement.serialize(output); + } + } } public static class InputPassportElementPassportRegistration extends InputPassportElement { public InputPersonalDocument passportRegistration; - public InputPassportElementPassportRegistration() { - } + public static final int CONSTRUCTOR = 1314562128; + + public InputPassportElementPassportRegistration() {} public InputPassportElementPassportRegistration(InputPersonalDocument passportRegistration) { this.passportRegistration = passportRegistration; } - public static final int CONSTRUCTOR = 1314562128; + public InputPassportElementPassportRegistration(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputPersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.passportRegistration = new InputPersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.passportRegistration == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.passportRegistration.serialize(output); + } + } } public static class InputPassportElementTemporaryRegistration extends InputPassportElement { public InputPersonalDocument temporaryRegistration; - public InputPassportElementTemporaryRegistration() { - } + public static final int CONSTRUCTOR = -1913238047; + + public InputPassportElementTemporaryRegistration() {} public InputPassportElementTemporaryRegistration(InputPersonalDocument temporaryRegistration) { this.temporaryRegistration = temporaryRegistration; } - public static final int CONSTRUCTOR = -1913238047; + public InputPassportElementTemporaryRegistration(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (InputPersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.temporaryRegistration = new InputPersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.temporaryRegistration == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.temporaryRegistration.serialize(output); + } + } } public static class InputPassportElementPhoneNumber extends InputPassportElement { public String phoneNumber; - public InputPassportElementPhoneNumber() { - } + public static final int CONSTRUCTOR = 1319357497; + + public InputPassportElementPhoneNumber() {} public InputPassportElementPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } - public static final int CONSTRUCTOR = 1319357497; + public InputPassportElementPhoneNumber(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + } } public static class InputPassportElementEmailAddress extends InputPassportElement { public String emailAddress; - public InputPassportElementEmailAddress() { - } + public static final int CONSTRUCTOR = -248605659; + + public InputPassportElementEmailAddress() {} public InputPassportElementEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } - public static final int CONSTRUCTOR = -248605659; + public InputPassportElementEmailAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emailAddressTmp = new byte[input.readInt()]; + input.readFully(emailAddressTmp); + this.emailAddress = new String(emailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emailAddressTmp = this.emailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(emailAddressTmp.length); + output.write(emailAddressTmp); + } + } } public static class InputPassportElementError extends Object { @@ -5769,8 +16470,9 @@ public class TdApi { public String message; public InputPassportElementErrorSource source; - public InputPassportElementError() { - } + public static final int CONSTRUCTOR = 285756898; + + public InputPassportElementError() {} public InputPassportElementError(PassportElementType type, String message, InputPassportElementErrorSource source) { this.type = type; @@ -5778,202 +16480,460 @@ public class TdApi { this.source = source; } - public static final int CONSTRUCTOR = 285756898; + public InputPassportElementError(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.type = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.type = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.type = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.type = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.type = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.type = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.type = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.type = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.type = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.type = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.type = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.type = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.type = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var messageTmp = new byte[input.readInt()]; + input.readFully(messageTmp); + this.message = new String(messageTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputPassportElementErrorSourceUnspecified.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceUnspecified(input); + break; + case InputPassportElementErrorSourceDataField.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceDataField(input); + break; + case InputPassportElementErrorSourceFrontSide.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceFrontSide(input); + break; + case InputPassportElementErrorSourceReverseSide.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceReverseSide(input); + break; + case InputPassportElementErrorSourceSelfie.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceSelfie(input); + break; + case InputPassportElementErrorSourceTranslationFile.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceTranslationFile(input); + break; + case InputPassportElementErrorSourceTranslationFiles.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceTranslationFiles(input); + break; + case InputPassportElementErrorSourceFile.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceFile(input); + break; + case InputPassportElementErrorSourceFiles.CONSTRUCTOR: + this.source = new InputPassportElementErrorSourceFiles(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputPassportElementErrorSource extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var messageTmp = this.message.getBytes(StandardCharsets.UTF_8); + output.writeInt(messageTmp.length); + output.write(messageTmp); + } + if (this.source == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.source.serialize(output); + } + } } public static class InputPassportElementErrorSourceUnspecified extends InputPassportElementErrorSource { public byte[] elementHash; - public InputPassportElementErrorSourceUnspecified() { - } + public static final int CONSTRUCTOR = 267230319; + + public InputPassportElementErrorSourceUnspecified() {} public InputPassportElementErrorSourceUnspecified(byte[] elementHash) { this.elementHash = elementHash; } - public static final int CONSTRUCTOR = 267230319; + public InputPassportElementErrorSourceUnspecified(DataInputStream input) throws IOException { + this.elementHash = new byte[input.readInt()]; + input.readFully(this.elementHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.elementHash.length); + output.write(this.elementHash); + } } public static class InputPassportElementErrorSourceDataField extends InputPassportElementErrorSource { public String fieldName; public byte[] dataHash; - public InputPassportElementErrorSourceDataField() { - } + public static final int CONSTRUCTOR = -426795002; + + public InputPassportElementErrorSourceDataField() {} public InputPassportElementErrorSourceDataField(String fieldName, byte[] dataHash) { this.fieldName = fieldName; this.dataHash = dataHash; } - public static final int CONSTRUCTOR = -426795002; + public InputPassportElementErrorSourceDataField(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var fieldNameTmp = new byte[input.readInt()]; + input.readFully(fieldNameTmp); + this.fieldName = new String(fieldNameTmp, StandardCharsets.UTF_8); + } + this.dataHash = new byte[input.readInt()]; + input.readFully(this.dataHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fieldName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fieldNameTmp = this.fieldName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fieldNameTmp.length); + output.write(fieldNameTmp); + } + output.writeInt(this.dataHash.length); + output.write(this.dataHash); + } } public static class InputPassportElementErrorSourceFrontSide extends InputPassportElementErrorSource { public byte[] fileHash; - public InputPassportElementErrorSourceFrontSide() { - } + public static final int CONSTRUCTOR = 588023741; + + public InputPassportElementErrorSourceFrontSide() {} public InputPassportElementErrorSourceFrontSide(byte[] fileHash) { this.fileHash = fileHash; } - public static final int CONSTRUCTOR = 588023741; + public InputPassportElementErrorSourceFrontSide(DataInputStream input) throws IOException { + this.fileHash = new byte[input.readInt()]; + input.readFully(this.fileHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHash.length); + output.write(this.fileHash); + } } public static class InputPassportElementErrorSourceReverseSide extends InputPassportElementErrorSource { public byte[] fileHash; - public InputPassportElementErrorSourceReverseSide() { - } + public static final int CONSTRUCTOR = 413072891; + + public InputPassportElementErrorSourceReverseSide() {} public InputPassportElementErrorSourceReverseSide(byte[] fileHash) { this.fileHash = fileHash; } - public static final int CONSTRUCTOR = 413072891; + public InputPassportElementErrorSourceReverseSide(DataInputStream input) throws IOException { + this.fileHash = new byte[input.readInt()]; + input.readFully(this.fileHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHash.length); + output.write(this.fileHash); + } } public static class InputPassportElementErrorSourceSelfie extends InputPassportElementErrorSource { public byte[] fileHash; - public InputPassportElementErrorSourceSelfie() { - } + public static final int CONSTRUCTOR = -773575528; + + public InputPassportElementErrorSourceSelfie() {} public InputPassportElementErrorSourceSelfie(byte[] fileHash) { this.fileHash = fileHash; } - public static final int CONSTRUCTOR = -773575528; + public InputPassportElementErrorSourceSelfie(DataInputStream input) throws IOException { + this.fileHash = new byte[input.readInt()]; + input.readFully(this.fileHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHash.length); + output.write(this.fileHash); + } } public static class InputPassportElementErrorSourceTranslationFile extends InputPassportElementErrorSource { public byte[] fileHash; - public InputPassportElementErrorSourceTranslationFile() { - } + public static final int CONSTRUCTOR = 505842299; + + public InputPassportElementErrorSourceTranslationFile() {} public InputPassportElementErrorSourceTranslationFile(byte[] fileHash) { this.fileHash = fileHash; } - public static final int CONSTRUCTOR = 505842299; + public InputPassportElementErrorSourceTranslationFile(DataInputStream input) throws IOException { + this.fileHash = new byte[input.readInt()]; + input.readFully(this.fileHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHash.length); + output.write(this.fileHash); + } } public static class InputPassportElementErrorSourceTranslationFiles extends InputPassportElementErrorSource { public byte[][] fileHashes; - public InputPassportElementErrorSourceTranslationFiles() { - } + public static final int CONSTRUCTOR = -527254048; + + public InputPassportElementErrorSourceTranslationFiles() {} public InputPassportElementErrorSourceTranslationFiles(byte[][] fileHashes) { this.fileHashes = fileHashes; } - public static final int CONSTRUCTOR = -527254048; + public InputPassportElementErrorSourceTranslationFiles(DataInputStream input) throws IOException { + this.fileHashes = new byte[input.readInt()][]; + for (int i = 0; i < this.fileHashes.length; i++) { + this.fileHashes[i] = new byte[input.readInt()]; + input.readFully(this.fileHashes[i]); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHashes.length); + for (int i = 0; i < this.fileHashes.length; i++) { + output.writeInt(this.fileHashes[i].length); + output.write(this.fileHashes[i]); + } + } } public static class InputPassportElementErrorSourceFile extends InputPassportElementErrorSource { public byte[] fileHash; - public InputPassportElementErrorSourceFile() { - } + public static final int CONSTRUCTOR = -298492469; + + public InputPassportElementErrorSourceFile() {} public InputPassportElementErrorSourceFile(byte[] fileHash) { this.fileHash = fileHash; } - public static final int CONSTRUCTOR = -298492469; + public InputPassportElementErrorSourceFile(DataInputStream input) throws IOException { + this.fileHash = new byte[input.readInt()]; + input.readFully(this.fileHash); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHash.length); + output.write(this.fileHash); + } } public static class InputPassportElementErrorSourceFiles extends InputPassportElementErrorSource { public byte[][] fileHashes; - public InputPassportElementErrorSourceFiles() { - } + public static final int CONSTRUCTOR = -2008541640; + + public InputPassportElementErrorSourceFiles() {} public InputPassportElementErrorSourceFiles(byte[][] fileHashes) { this.fileHashes = fileHashes; } - public static final int CONSTRUCTOR = -2008541640; + public InputPassportElementErrorSourceFiles(DataInputStream input) throws IOException { + this.fileHashes = new byte[input.readInt()][]; + for (int i = 0; i < this.fileHashes.length; i++) { + this.fileHashes[i] = new byte[input.readInt()]; + input.readFully(this.fileHashes[i]); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileHashes.length); + for (int i = 0; i < this.fileHashes.length; i++) { + output.writeInt(this.fileHashes[i].length); + output.write(this.fileHashes[i]); + } + } } public static class InputPersonalDocument extends Object { public InputFile[] files; public InputFile[] translation; - public InputPersonalDocument() { - } + public static final int CONSTRUCTOR = 1676966826; + + public InputPersonalDocument() {} public InputPersonalDocument(InputFile[] files, InputFile[] translation) { this.files = files; this.translation = translation; } - public static final int CONSTRUCTOR = 1676966826; + public InputPersonalDocument(DataInputStream input) throws IOException { + this.files = new InputFile[input.readInt()]; + for (int i = 0; i < this.files.length; i++) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.files[i] = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.files[i] = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.files[i] = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.files[i] = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.translation = new InputFile[input.readInt()]; + for (int i = 0; i < this.translation.length; i++) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.translation[i] = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.translation[i] = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.translation[i] = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.translation[i] = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class InputSticker extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.files.length); + for (int i = 0; i < this.files.length; i++) { + this.files[i].serialize(output); + } + output.writeInt(this.translation.length); + for (int i = 0; i < this.translation.length; i++) { + this.translation[i].serialize(output); + } + } } public static class InputStickerStatic extends InputSticker { @@ -5981,8 +16941,9 @@ public class TdApi { public String emojis; public MaskPosition maskPosition; - public InputStickerStatic() { - } + public static final int CONSTRUCTOR = 1409680603; + + public InputStickerStatic() {} public InputStickerStatic(InputFile sticker, String emojis, MaskPosition maskPosition) { this.sticker = sticker; @@ -5990,32 +16951,127 @@ public class TdApi { this.maskPosition = maskPosition; } - public static final int CONSTRUCTOR = 1409680603; + public InputStickerStatic(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var emojisTmp = new byte[input.readInt()]; + input.readFully(emojisTmp); + this.emojis = new String(emojisTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (MaskPosition.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.maskPosition = new MaskPosition(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + if (this.emojis == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojisTmp = this.emojis.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojisTmp.length); + output.write(emojisTmp); + } + if (this.maskPosition == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.maskPosition.serialize(output); + } + } } public static class InputStickerAnimated extends InputSticker { public InputFile sticker; public String emojis; - public InputStickerAnimated() { - } + public static final int CONSTRUCTOR = -1127265952; + + public InputStickerAnimated() {} public InputStickerAnimated(InputFile sticker, String emojis) { this.sticker = sticker; this.emojis = emojis; } - public static final int CONSTRUCTOR = -1127265952; + public InputStickerAnimated(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var emojisTmp = new byte[input.readInt()]; + input.readFully(emojisTmp); + this.emojis = new String(emojisTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + if (this.emojis == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojisTmp = this.emojis.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojisTmp.length); + output.write(emojisTmp); + } + } } public static class InputThumbnail extends Object { @@ -6023,8 +17079,9 @@ public class TdApi { public int width; public int height; - public InputThumbnail() { - } + public static final int CONSTRUCTOR = 1582387236; + + public InputThumbnail() {} public InputThumbnail(InputFile thumbnail, int width, int height) { this.thumbnail = thumbnail; @@ -6032,12 +17089,44 @@ public class TdApi { this.height = height; } - public static final int CONSTRUCTOR = 1582387236; + public InputThumbnail(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.thumbnail = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.thumbnail = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.thumbnail = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.thumbnail = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.width = input.readInt(); + this.height = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeInt(this.width); + output.writeInt(this.height); + } } public static class Invoice extends Object { @@ -6052,8 +17141,9 @@ public class TdApi { public boolean sendEmailAddressToProvider; public boolean isFlexible; - public Invoice() { - } + public static final int CONSTRUCTOR = -368451690; + + public Invoice() {} public Invoice(String currency, LabeledPricePart[] priceParts, boolean isTest, boolean needName, boolean needPhoneNumber, boolean needEmailAddress, boolean needShippingAddress, boolean sendPhoneNumberToProvider, boolean sendEmailAddressToProvider, boolean isFlexible) { this.currency = currency; @@ -6068,240 +17158,499 @@ public class TdApi { this.isFlexible = isFlexible; } - public static final int CONSTRUCTOR = -368451690; + public Invoice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var currencyTmp = new byte[input.readInt()]; + input.readFully(currencyTmp); + this.currency = new String(currencyTmp, StandardCharsets.UTF_8); + } + this.priceParts = new LabeledPricePart[input.readInt()]; + for (int i = 0; i < this.priceParts.length; i++) { + if (LabeledPricePart.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.priceParts[i] = new LabeledPricePart(input); + } + this.isTest = input.readBoolean(); + this.needName = input.readBoolean(); + this.needPhoneNumber = input.readBoolean(); + this.needEmailAddress = input.readBoolean(); + this.needShippingAddress = input.readBoolean(); + this.sendPhoneNumberToProvider = input.readBoolean(); + this.sendEmailAddressToProvider = input.readBoolean(); + this.isFlexible = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.currency == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var currencyTmp = this.currency.getBytes(StandardCharsets.UTF_8); + output.writeInt(currencyTmp.length); + output.write(currencyTmp); + } + output.writeInt(this.priceParts.length); + for (int i = 0; i < this.priceParts.length; i++) { + this.priceParts[i].serialize(output); + } + output.writeBoolean(this.isTest); + output.writeBoolean(this.needName); + output.writeBoolean(this.needPhoneNumber); + output.writeBoolean(this.needEmailAddress); + output.writeBoolean(this.needShippingAddress); + output.writeBoolean(this.sendPhoneNumberToProvider); + output.writeBoolean(this.sendEmailAddressToProvider); + output.writeBoolean(this.isFlexible); + } } public static class JsonObjectMember extends Object { public String key; public JsonValue value; - public JsonObjectMember() { - } + public static final int CONSTRUCTOR = -1803309418; + + public JsonObjectMember() {} public JsonObjectMember(String key, JsonValue value) { this.key = key; this.value = value; } - public static final int CONSTRUCTOR = -1803309418; + public JsonObjectMember(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var keyTmp = new byte[input.readInt()]; + input.readFully(keyTmp); + this.key = new String(keyTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case JsonValueNull.CONSTRUCTOR: + this.value = new JsonValueNull(input); + break; + case JsonValueBoolean.CONSTRUCTOR: + this.value = new JsonValueBoolean(input); + break; + case JsonValueNumber.CONSTRUCTOR: + this.value = new JsonValueNumber(input); + break; + case JsonValueString.CONSTRUCTOR: + this.value = new JsonValueString(input); + break; + case JsonValueArray.CONSTRUCTOR: + this.value = new JsonValueArray(input); + break; + case JsonValueObject.CONSTRUCTOR: + this.value = new JsonValueObject(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class JsonValue extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.key == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var keyTmp = this.key.getBytes(StandardCharsets.UTF_8); + output.writeInt(keyTmp.length); + output.write(keyTmp); + } + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.value.serialize(output); + } + } } public static class JsonValueNull extends JsonValue { - - public JsonValueNull() { - } - public static final int CONSTRUCTOR = -92872499; - @Override + public JsonValueNull() {} + + + public JsonValueNull(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class JsonValueBoolean extends JsonValue { public boolean value; - public JsonValueBoolean() { - } + public static final int CONSTRUCTOR = -2142186576; + + public JsonValueBoolean() {} public JsonValueBoolean(boolean value) { this.value = value; } - public static final int CONSTRUCTOR = -2142186576; + public JsonValueBoolean(DataInputStream input) throws IOException { + this.value = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.value); + } } public static class JsonValueNumber extends JsonValue { public double value; - public JsonValueNumber() { - } + public static final int CONSTRUCTOR = -1010822033; + + public JsonValueNumber() {} public JsonValueNumber(double value) { this.value = value; } - public static final int CONSTRUCTOR = -1010822033; + public JsonValueNumber(DataInputStream input) throws IOException { + this.value = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeDouble(this.value); + } } public static class JsonValueString extends JsonValue { public String value; - public JsonValueString() { - } + public static final int CONSTRUCTOR = 1597947313; + + public JsonValueString() {} public JsonValueString(String value) { this.value = value; } - public static final int CONSTRUCTOR = 1597947313; + public JsonValueString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var valueTmp = new byte[input.readInt()]; + input.readFully(valueTmp); + this.value = new String(valueTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var valueTmp = this.value.getBytes(StandardCharsets.UTF_8); + output.writeInt(valueTmp.length); + output.write(valueTmp); + } + } } public static class JsonValueArray extends JsonValue { public JsonValue[] values; - public JsonValueArray() { - } + public static final int CONSTRUCTOR = -183913546; + + public JsonValueArray() {} public JsonValueArray(JsonValue[] values) { this.values = values; } - public static final int CONSTRUCTOR = -183913546; + public JsonValueArray(DataInputStream input) throws IOException { + this.values = new JsonValue[input.readInt()]; + for (int i = 0; i < this.values.length; i++) { + switch(input.readInt()) { + case JsonValueNull.CONSTRUCTOR: + this.values[i] = new JsonValueNull(input); + break; + case JsonValueBoolean.CONSTRUCTOR: + this.values[i] = new JsonValueBoolean(input); + break; + case JsonValueNumber.CONSTRUCTOR: + this.values[i] = new JsonValueNumber(input); + break; + case JsonValueString.CONSTRUCTOR: + this.values[i] = new JsonValueString(input); + break; + case JsonValueArray.CONSTRUCTOR: + this.values[i] = new JsonValueArray(input); + break; + case JsonValueObject.CONSTRUCTOR: + this.values[i] = new JsonValueObject(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.values.length); + for (int i = 0; i < this.values.length; i++) { + this.values[i].serialize(output); + } + } } public static class JsonValueObject extends JsonValue { public JsonObjectMember[] members; - public JsonValueObject() { - } + public static final int CONSTRUCTOR = 520252026; + + public JsonValueObject() {} public JsonValueObject(JsonObjectMember[] members) { this.members = members; } - public static final int CONSTRUCTOR = 520252026; + public JsonValueObject(DataInputStream input) throws IOException { + this.members = new JsonObjectMember[input.readInt()]; + for (int i = 0; i < this.members.length; i++) { + if (JsonObjectMember.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.members[i] = new JsonObjectMember(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.members.length); + for (int i = 0; i < this.members.length; i++) { + this.members[i].serialize(output); + } + } } public static class KeyboardButton extends Object { public String text; public KeyboardButtonType type; - public KeyboardButton() { - } + public static final int CONSTRUCTOR = -2069836172; + + public KeyboardButton() {} public KeyboardButton(String text, KeyboardButtonType type) { this.text = text; this.type = type; } - public static final int CONSTRUCTOR = -2069836172; + public KeyboardButton(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case KeyboardButtonTypeText.CONSTRUCTOR: + this.type = new KeyboardButtonTypeText(input); + break; + case KeyboardButtonTypeRequestPhoneNumber.CONSTRUCTOR: + this.type = new KeyboardButtonTypeRequestPhoneNumber(input); + break; + case KeyboardButtonTypeRequestLocation.CONSTRUCTOR: + this.type = new KeyboardButtonTypeRequestLocation(input); + break; + case KeyboardButtonTypeRequestPoll.CONSTRUCTOR: + this.type = new KeyboardButtonTypeRequestPoll(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class KeyboardButtonType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class KeyboardButtonTypeText extends KeyboardButtonType { - - public KeyboardButtonTypeText() { - } - public static final int CONSTRUCTOR = -1773037256; - @Override + public KeyboardButtonTypeText() {} + + + public KeyboardButtonTypeText(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class KeyboardButtonTypeRequestPhoneNumber extends KeyboardButtonType { - - public KeyboardButtonTypeRequestPhoneNumber() { - } - public static final int CONSTRUCTOR = -1529235527; - @Override + public KeyboardButtonTypeRequestPhoneNumber() {} + + + public KeyboardButtonTypeRequestPhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class KeyboardButtonTypeRequestLocation extends KeyboardButtonType { - - public KeyboardButtonTypeRequestLocation() { - } - public static final int CONSTRUCTOR = -125661955; - @Override + public KeyboardButtonTypeRequestLocation() {} + + + public KeyboardButtonTypeRequestLocation(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class KeyboardButtonTypeRequestPoll extends KeyboardButtonType { public boolean forceRegular; public boolean forceQuiz; - public KeyboardButtonTypeRequestPoll() { - } + public static final int CONSTRUCTOR = 1902435512; + + public KeyboardButtonTypeRequestPoll() {} public KeyboardButtonTypeRequestPoll(boolean forceRegular, boolean forceQuiz) { this.forceRegular = forceRegular; this.forceQuiz = forceQuiz; } - public static final int CONSTRUCTOR = 1902435512; + public KeyboardButtonTypeRequestPoll(DataInputStream input) throws IOException { + this.forceRegular = input.readBoolean(); + this.forceQuiz = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.forceRegular); + output.writeBoolean(this.forceQuiz); + } } public static class LabeledPricePart extends Object { public String label; public long amount; - public LabeledPricePart() { - } + public static final int CONSTRUCTOR = 552789798; + + public LabeledPricePart() {} public LabeledPricePart(String label, long amount) { this.label = label; this.amount = amount; } - public static final int CONSTRUCTOR = 552789798; + public LabeledPricePart(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var labelTmp = new byte[input.readInt()]; + input.readFully(labelTmp); + this.label = new String(labelTmp, StandardCharsets.UTF_8); + } + this.amount = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.label == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var labelTmp = this.label.getBytes(StandardCharsets.UTF_8); + output.writeInt(labelTmp.length); + output.write(labelTmp); + } + output.writeLong(this.amount); + } } public static class LanguagePackInfo extends Object { @@ -6319,8 +17668,9 @@ public class TdApi { public int localStringCount; public String translationUrl; - public LanguagePackInfo() { - } + public static final int CONSTRUCTOR = 542199642; + + public LanguagePackInfo() {} public LanguagePackInfo(String id, String baseLanguagePackId, String name, String nativeName, String pluralCode, boolean isOfficial, boolean isRtl, boolean isBeta, boolean isInstalled, int totalStringCount, int translatedStringCount, int localStringCount, String translationUrl) { this.id = id; @@ -6338,53 +17688,203 @@ public class TdApi { this.translationUrl = translationUrl; } - public static final int CONSTRUCTOR = 542199642; + public LanguagePackInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var baseLanguagePackIdTmp = new byte[input.readInt()]; + input.readFully(baseLanguagePackIdTmp); + this.baseLanguagePackId = new String(baseLanguagePackIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nativeNameTmp = new byte[input.readInt()]; + input.readFully(nativeNameTmp); + this.nativeName = new String(nativeNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var pluralCodeTmp = new byte[input.readInt()]; + input.readFully(pluralCodeTmp); + this.pluralCode = new String(pluralCodeTmp, StandardCharsets.UTF_8); + } + this.isOfficial = input.readBoolean(); + this.isRtl = input.readBoolean(); + this.isBeta = input.readBoolean(); + this.isInstalled = input.readBoolean(); + this.totalStringCount = input.readInt(); + this.translatedStringCount = input.readInt(); + this.localStringCount = input.readInt(); + if (input.readBoolean()) { + var translationUrlTmp = new byte[input.readInt()]; + input.readFully(translationUrlTmp); + this.translationUrl = new String(translationUrlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.baseLanguagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var baseLanguagePackIdTmp = this.baseLanguagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(baseLanguagePackIdTmp.length); + output.write(baseLanguagePackIdTmp); + } + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.nativeName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nativeNameTmp = this.nativeName.getBytes(StandardCharsets.UTF_8); + output.writeInt(nativeNameTmp.length); + output.write(nativeNameTmp); + } + if (this.pluralCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var pluralCodeTmp = this.pluralCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(pluralCodeTmp.length); + output.write(pluralCodeTmp); + } + output.writeBoolean(this.isOfficial); + output.writeBoolean(this.isRtl); + output.writeBoolean(this.isBeta); + output.writeBoolean(this.isInstalled); + output.writeInt(this.totalStringCount); + output.writeInt(this.translatedStringCount); + output.writeInt(this.localStringCount); + if (this.translationUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var translationUrlTmp = this.translationUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(translationUrlTmp.length); + output.write(translationUrlTmp); + } + } } public static class LanguagePackString extends Object { public String key; public LanguagePackStringValue value; - public LanguagePackString() { - } + public static final int CONSTRUCTOR = 1307632736; + + public LanguagePackString() {} public LanguagePackString(String key, LanguagePackStringValue value) { this.key = key; this.value = value; } - public static final int CONSTRUCTOR = 1307632736; + public LanguagePackString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var keyTmp = new byte[input.readInt()]; + input.readFully(keyTmp); + this.key = new String(keyTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case LanguagePackStringValueOrdinary.CONSTRUCTOR: + this.value = new LanguagePackStringValueOrdinary(input); + break; + case LanguagePackStringValuePluralized.CONSTRUCTOR: + this.value = new LanguagePackStringValuePluralized(input); + break; + case LanguagePackStringValueDeleted.CONSTRUCTOR: + this.value = new LanguagePackStringValueDeleted(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class LanguagePackStringValue extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.key == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var keyTmp = this.key.getBytes(StandardCharsets.UTF_8); + output.writeInt(keyTmp.length); + output.write(keyTmp); + } + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.value.serialize(output); + } + } } public static class LanguagePackStringValueOrdinary extends LanguagePackStringValue { public String value; - public LanguagePackStringValueOrdinary() { - } + public static final int CONSTRUCTOR = -249256352; + + public LanguagePackStringValueOrdinary() {} public LanguagePackStringValueOrdinary(String value) { this.value = value; } - public static final int CONSTRUCTOR = -249256352; + public LanguagePackStringValueOrdinary(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var valueTmp = new byte[input.readInt()]; + input.readFully(valueTmp); + this.value = new String(valueTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var valueTmp = this.value.getBytes(StandardCharsets.UTF_8); + output.writeInt(valueTmp.length); + output.write(valueTmp); + } + } } public static class LanguagePackStringValuePluralized extends LanguagePackStringValue { @@ -6395,8 +17895,9 @@ public class TdApi { public String manyValue; public String otherValue; - public LanguagePackStringValuePluralized() { - } + public static final int CONSTRUCTOR = 1906840261; + + public LanguagePackStringValuePluralized() {} public LanguagePackStringValuePluralized(String zeroValue, String oneValue, String twoValue, String fewValue, String manyValue, String otherValue) { this.zeroValue = zeroValue; @@ -6407,43 +17908,146 @@ public class TdApi { this.otherValue = otherValue; } - public static final int CONSTRUCTOR = 1906840261; + public LanguagePackStringValuePluralized(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var zeroValueTmp = new byte[input.readInt()]; + input.readFully(zeroValueTmp); + this.zeroValue = new String(zeroValueTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var oneValueTmp = new byte[input.readInt()]; + input.readFully(oneValueTmp); + this.oneValue = new String(oneValueTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var twoValueTmp = new byte[input.readInt()]; + input.readFully(twoValueTmp); + this.twoValue = new String(twoValueTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var fewValueTmp = new byte[input.readInt()]; + input.readFully(fewValueTmp); + this.fewValue = new String(fewValueTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var manyValueTmp = new byte[input.readInt()]; + input.readFully(manyValueTmp); + this.manyValue = new String(manyValueTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var otherValueTmp = new byte[input.readInt()]; + input.readFully(otherValueTmp); + this.otherValue = new String(otherValueTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.zeroValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var zeroValueTmp = this.zeroValue.getBytes(StandardCharsets.UTF_8); + output.writeInt(zeroValueTmp.length); + output.write(zeroValueTmp); + } + if (this.oneValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var oneValueTmp = this.oneValue.getBytes(StandardCharsets.UTF_8); + output.writeInt(oneValueTmp.length); + output.write(oneValueTmp); + } + if (this.twoValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var twoValueTmp = this.twoValue.getBytes(StandardCharsets.UTF_8); + output.writeInt(twoValueTmp.length); + output.write(twoValueTmp); + } + if (this.fewValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fewValueTmp = this.fewValue.getBytes(StandardCharsets.UTF_8); + output.writeInt(fewValueTmp.length); + output.write(fewValueTmp); + } + if (this.manyValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var manyValueTmp = this.manyValue.getBytes(StandardCharsets.UTF_8); + output.writeInt(manyValueTmp.length); + output.write(manyValueTmp); + } + if (this.otherValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var otherValueTmp = this.otherValue.getBytes(StandardCharsets.UTF_8); + output.writeInt(otherValueTmp.length); + output.write(otherValueTmp); + } + } } public static class LanguagePackStringValueDeleted extends LanguagePackStringValue { - - public LanguagePackStringValueDeleted() { - } - public static final int CONSTRUCTOR = 1834792698; - @Override + public LanguagePackStringValueDeleted() {} + + + public LanguagePackStringValueDeleted(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class LanguagePackStrings extends Object { public LanguagePackString[] strings; - public LanguagePackStrings() { - } + public static final int CONSTRUCTOR = 1172082922; + + public LanguagePackStrings() {} public LanguagePackStrings(LanguagePackString[] strings) { this.strings = strings; } - public static final int CONSTRUCTOR = 1172082922; + public LanguagePackStrings(DataInputStream input) throws IOException { + this.strings = new LanguagePackString[input.readInt()]; + for (int i = 0; i < this.strings.length; i++) { + if (LanguagePackString.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.strings[i] = new LanguagePackString(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.strings.length); + for (int i = 0; i < this.strings.length; i++) { + this.strings[i].serialize(output); + } + } } public static class LocalFile extends Object { @@ -6456,8 +18060,9 @@ public class TdApi { public int downloadedPrefixSize; public int downloadedSize; - public LocalFile() { - } + public static final int CONSTRUCTOR = -1166400317; + + public LocalFile() {} public LocalFile(String path, boolean canBeDownloaded, boolean canBeDeleted, boolean isDownloadingActive, boolean isDownloadingCompleted, int downloadOffset, int downloadedPrefixSize, int downloadedSize) { this.path = path; @@ -6470,158 +18075,282 @@ public class TdApi { this.downloadedSize = downloadedSize; } - public static final int CONSTRUCTOR = -1166400317; + public LocalFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var pathTmp = new byte[input.readInt()]; + input.readFully(pathTmp); + this.path = new String(pathTmp, StandardCharsets.UTF_8); + } + this.canBeDownloaded = input.readBoolean(); + this.canBeDeleted = input.readBoolean(); + this.isDownloadingActive = input.readBoolean(); + this.isDownloadingCompleted = input.readBoolean(); + this.downloadOffset = input.readInt(); + this.downloadedPrefixSize = input.readInt(); + this.downloadedSize = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.path == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var pathTmp = this.path.getBytes(StandardCharsets.UTF_8); + output.writeInt(pathTmp.length); + output.write(pathTmp); + } + output.writeBoolean(this.canBeDownloaded); + output.writeBoolean(this.canBeDeleted); + output.writeBoolean(this.isDownloadingActive); + output.writeBoolean(this.isDownloadingCompleted); + output.writeInt(this.downloadOffset); + output.writeInt(this.downloadedPrefixSize); + output.writeInt(this.downloadedSize); + } } public static class LocalizationTargetInfo extends Object { public LanguagePackInfo[] languagePacks; - public LocalizationTargetInfo() { - } + public static final int CONSTRUCTOR = -2048670809; + + public LocalizationTargetInfo() {} public LocalizationTargetInfo(LanguagePackInfo[] languagePacks) { this.languagePacks = languagePacks; } - public static final int CONSTRUCTOR = -2048670809; + public LocalizationTargetInfo(DataInputStream input) throws IOException { + this.languagePacks = new LanguagePackInfo[input.readInt()]; + for (int i = 0; i < this.languagePacks.length; i++) { + if (LanguagePackInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.languagePacks[i] = new LanguagePackInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.languagePacks.length); + for (int i = 0; i < this.languagePacks.length; i++) { + this.languagePacks[i].serialize(output); + } + } } public static class Location extends Object { public double latitude; public double longitude; - public Location() { - } + public static final int CONSTRUCTOR = 749028016; + + public Location() {} public Location(double latitude, double longitude) { this.latitude = latitude; this.longitude = longitude; } - public static final int CONSTRUCTOR = 749028016; + public Location(DataInputStream input) throws IOException { + this.latitude = input.readDouble(); + this.longitude = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class LogStream extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeDouble(this.latitude); + output.writeDouble(this.longitude); + } } public static class LogStreamDefault extends LogStream { - - public LogStreamDefault() { - } - public static final int CONSTRUCTOR = 1390581436; - @Override + public LogStreamDefault() {} + + + public LogStreamDefault(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class LogStreamFile extends LogStream { public String path; public long maxFileSize; - public LogStreamFile() { - } + public static final int CONSTRUCTOR = -1880085930; + + public LogStreamFile() {} public LogStreamFile(String path, long maxFileSize) { this.path = path; this.maxFileSize = maxFileSize; } - public static final int CONSTRUCTOR = -1880085930; + public LogStreamFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var pathTmp = new byte[input.readInt()]; + input.readFully(pathTmp); + this.path = new String(pathTmp, StandardCharsets.UTF_8); + } + this.maxFileSize = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.path == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var pathTmp = this.path.getBytes(StandardCharsets.UTF_8); + output.writeInt(pathTmp.length); + output.write(pathTmp); + } + output.writeLong(this.maxFileSize); + } } public static class LogStreamEmpty extends LogStream { - - public LogStreamEmpty() { - } - public static final int CONSTRUCTOR = -499912244; - @Override + public LogStreamEmpty() {} + + + public LogStreamEmpty(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class LogTags extends Object { public String[] tags; - public LogTags() { - } + public static final int CONSTRUCTOR = -1604930601; + + public LogTags() {} public LogTags(String[] tags) { this.tags = tags; } - public static final int CONSTRUCTOR = -1604930601; + public LogTags(DataInputStream input) throws IOException { + this.tags = new String[input.readInt()]; + for (int i = 0; i < this.tags.length; i++) { + var tagsTmp = new byte[input.readInt()]; + input.readFully(tagsTmp); + this.tags[i] = new String(tagsTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.tags.length); + for (int i = 0; i < this.tags.length; i++) { + var tagsTmp = this.tags[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(tagsTmp.length); + output.write(tagsTmp); + } + } } public static class LogVerbosityLevel extends Object { public int verbosityLevel; - public LogVerbosityLevel() { - } + public static final int CONSTRUCTOR = 1734624234; + + public LogVerbosityLevel() {} public LogVerbosityLevel(int verbosityLevel) { this.verbosityLevel = verbosityLevel; } - public static final int CONSTRUCTOR = 1734624234; + public LogVerbosityLevel(DataInputStream input) throws IOException { + this.verbosityLevel = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class LoginUrlInfo extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.verbosityLevel); + } } public static class LoginUrlInfoOpen extends LoginUrlInfo { public String url; public boolean skipConfirm; - public LoginUrlInfoOpen() { - } + public static final int CONSTRUCTOR = -1079045420; + + public LoginUrlInfoOpen() {} public LoginUrlInfoOpen(String url, boolean skipConfirm) { this.url = url; this.skipConfirm = skipConfirm; } - public static final int CONSTRUCTOR = -1079045420; + public LoginUrlInfoOpen(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.skipConfirm = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeBoolean(this.skipConfirm); + } } public static class LoginUrlInfoRequestConfirmation extends LoginUrlInfo { @@ -6630,8 +18359,9 @@ public class TdApi { public int botUserId; public boolean requestWriteAccess; - public LoginUrlInfoRequestConfirmation() { - } + public static final int CONSTRUCTOR = -1761898342; + + public LoginUrlInfoRequestConfirmation() {} public LoginUrlInfoRequestConfirmation(String url, String domain, int botUserId, boolean requestWriteAccess) { this.url = url; @@ -6640,67 +18370,118 @@ public class TdApi { this.requestWriteAccess = requestWriteAccess; } - public static final int CONSTRUCTOR = -1761898342; + public LoginUrlInfoRequestConfirmation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var domainTmp = new byte[input.readInt()]; + input.readFully(domainTmp); + this.domain = new String(domainTmp, StandardCharsets.UTF_8); + } + this.botUserId = input.readInt(); + this.requestWriteAccess = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class MaskPoint extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.domain == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var domainTmp = this.domain.getBytes(StandardCharsets.UTF_8); + output.writeInt(domainTmp.length); + output.write(domainTmp); + } + output.writeInt(this.botUserId); + output.writeBoolean(this.requestWriteAccess); + } } public static class MaskPointForehead extends MaskPoint { - - public MaskPointForehead() { - } - public static final int CONSTRUCTOR = 1027512005; - @Override + public MaskPointForehead() {} + + + public MaskPointForehead(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MaskPointEyes extends MaskPoint { - - public MaskPointEyes() { - } - public static final int CONSTRUCTOR = 1748310861; - @Override + public MaskPointEyes() {} + + + public MaskPointEyes(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MaskPointMouth extends MaskPoint { - - public MaskPointMouth() { - } - public static final int CONSTRUCTOR = 411773406; - @Override + public MaskPointMouth() {} + + + public MaskPointMouth(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MaskPointChin extends MaskPoint { - - public MaskPointChin() { - } - public static final int CONSTRUCTOR = 534995335; - @Override + public MaskPointChin() {} + + + public MaskPointChin(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MaskPosition extends Object { @@ -6709,8 +18490,9 @@ public class TdApi { public double yShift; public double scale; - public MaskPosition() { - } + public static final int CONSTRUCTOR = -2097433026; + + public MaskPosition() {} public MaskPosition(MaskPoint point, double xShift, double yShift, double scale) { this.point = point; @@ -6719,12 +18501,46 @@ public class TdApi { this.scale = scale; } - public static final int CONSTRUCTOR = -2097433026; + public MaskPosition(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case MaskPointForehead.CONSTRUCTOR: + this.point = new MaskPointForehead(input); + break; + case MaskPointEyes.CONSTRUCTOR: + this.point = new MaskPointEyes(input); + break; + case MaskPointMouth.CONSTRUCTOR: + this.point = new MaskPointMouth(input); + break; + case MaskPointChin.CONSTRUCTOR: + this.point = new MaskPointChin(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.xShift = input.readDouble(); + this.yShift = input.readDouble(); + this.scale = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.point == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.point.serialize(output); + } + output.writeDouble(this.xShift); + output.writeDouble(this.yShift); + output.writeDouble(this.scale); + } } public static class Message extends Object { @@ -6754,8 +18570,9 @@ public class TdApi { public MessageContent content; public ReplyMarkup replyMarkup; - public Message() { - } + public static final int CONSTRUCTOR = 1169109781; + + public Message() {} public Message(long id, int senderUserId, long chatId, MessageSendingState sendingState, MessageSchedulingState schedulingState, boolean isOutgoing, boolean canBeEdited, boolean canBeForwarded, boolean canBeDeletedOnlyForSelf, boolean canBeDeletedForAllUsers, boolean isChannelPost, boolean containsUnreadMention, int date, int editDate, MessageForwardInfo forwardInfo, long replyToMessageId, int ttl, double ttlExpiresIn, int viaBotUserId, String authorSignature, int views, long mediaAlbumId, String restrictionReason, MessageContent content, ReplyMarkup replyMarkup) { this.id = id; @@ -6785,35 +18602,334 @@ public class TdApi { this.replyMarkup = replyMarkup; } - public static final int CONSTRUCTOR = 1169109781; + public Message(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.senderUserId = input.readInt(); + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageSendingStatePending.CONSTRUCTOR: + this.sendingState = new MessageSendingStatePending(input); + break; + case MessageSendingStateFailed.CONSTRUCTOR: + this.sendingState = new MessageSendingStateFailed(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageSchedulingStateSendAtDate.CONSTRUCTOR: + this.schedulingState = new MessageSchedulingStateSendAtDate(input); + break; + case MessageSchedulingStateSendWhenOnline.CONSTRUCTOR: + this.schedulingState = new MessageSchedulingStateSendWhenOnline(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.isOutgoing = input.readBoolean(); + this.canBeEdited = input.readBoolean(); + this.canBeForwarded = input.readBoolean(); + this.canBeDeletedOnlyForSelf = input.readBoolean(); + this.canBeDeletedForAllUsers = input.readBoolean(); + this.isChannelPost = input.readBoolean(); + this.containsUnreadMention = input.readBoolean(); + this.date = input.readInt(); + this.editDate = input.readInt(); + if (input.readBoolean()) { + if (MessageForwardInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.forwardInfo = new MessageForwardInfo(input); + } + this.replyToMessageId = input.readLong(); + this.ttl = input.readInt(); + this.ttlExpiresIn = input.readDouble(); + this.viaBotUserId = input.readInt(); + if (input.readBoolean()) { + var authorSignatureTmp = new byte[input.readInt()]; + input.readFully(authorSignatureTmp); + this.authorSignature = new String(authorSignatureTmp, StandardCharsets.UTF_8); + } + this.views = input.readInt(); + this.mediaAlbumId = input.readLong(); + if (input.readBoolean()) { + var restrictionReasonTmp = new byte[input.readInt()]; + input.readFully(restrictionReasonTmp); + this.restrictionReason = new String(restrictionReasonTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageText.CONSTRUCTOR: + this.content = new MessageText(input); + break; + case MessageAnimation.CONSTRUCTOR: + this.content = new MessageAnimation(input); + break; + case MessageAudio.CONSTRUCTOR: + this.content = new MessageAudio(input); + break; + case MessageDocument.CONSTRUCTOR: + this.content = new MessageDocument(input); + break; + case MessagePhoto.CONSTRUCTOR: + this.content = new MessagePhoto(input); + break; + case MessageExpiredPhoto.CONSTRUCTOR: + this.content = new MessageExpiredPhoto(input); + break; + case MessageSticker.CONSTRUCTOR: + this.content = new MessageSticker(input); + break; + case MessageVideo.CONSTRUCTOR: + this.content = new MessageVideo(input); + break; + case MessageExpiredVideo.CONSTRUCTOR: + this.content = new MessageExpiredVideo(input); + break; + case MessageVideoNote.CONSTRUCTOR: + this.content = new MessageVideoNote(input); + break; + case MessageVoiceNote.CONSTRUCTOR: + this.content = new MessageVoiceNote(input); + break; + case MessageLocation.CONSTRUCTOR: + this.content = new MessageLocation(input); + break; + case MessageVenue.CONSTRUCTOR: + this.content = new MessageVenue(input); + break; + case MessageContact.CONSTRUCTOR: + this.content = new MessageContact(input); + break; + case MessageDice.CONSTRUCTOR: + this.content = new MessageDice(input); + break; + case MessageGame.CONSTRUCTOR: + this.content = new MessageGame(input); + break; + case MessagePoll.CONSTRUCTOR: + this.content = new MessagePoll(input); + break; + case MessageInvoice.CONSTRUCTOR: + this.content = new MessageInvoice(input); + break; + case MessageCall.CONSTRUCTOR: + this.content = new MessageCall(input); + break; + case MessageBasicGroupChatCreate.CONSTRUCTOR: + this.content = new MessageBasicGroupChatCreate(input); + break; + case MessageSupergroupChatCreate.CONSTRUCTOR: + this.content = new MessageSupergroupChatCreate(input); + break; + case MessageChatChangeTitle.CONSTRUCTOR: + this.content = new MessageChatChangeTitle(input); + break; + case MessageChatChangePhoto.CONSTRUCTOR: + this.content = new MessageChatChangePhoto(input); + break; + case MessageChatDeletePhoto.CONSTRUCTOR: + this.content = new MessageChatDeletePhoto(input); + break; + case MessageChatAddMembers.CONSTRUCTOR: + this.content = new MessageChatAddMembers(input); + break; + case MessageChatJoinByLink.CONSTRUCTOR: + this.content = new MessageChatJoinByLink(input); + break; + case MessageChatDeleteMember.CONSTRUCTOR: + this.content = new MessageChatDeleteMember(input); + break; + case MessageChatUpgradeTo.CONSTRUCTOR: + this.content = new MessageChatUpgradeTo(input); + break; + case MessageChatUpgradeFrom.CONSTRUCTOR: + this.content = new MessageChatUpgradeFrom(input); + break; + case MessagePinMessage.CONSTRUCTOR: + this.content = new MessagePinMessage(input); + break; + case MessageScreenshotTaken.CONSTRUCTOR: + this.content = new MessageScreenshotTaken(input); + break; + case MessageChatSetTtl.CONSTRUCTOR: + this.content = new MessageChatSetTtl(input); + break; + case MessageCustomServiceAction.CONSTRUCTOR: + this.content = new MessageCustomServiceAction(input); + break; + case MessageGameScore.CONSTRUCTOR: + this.content = new MessageGameScore(input); + break; + case MessagePaymentSuccessful.CONSTRUCTOR: + this.content = new MessagePaymentSuccessful(input); + break; + case MessagePaymentSuccessfulBot.CONSTRUCTOR: + this.content = new MessagePaymentSuccessfulBot(input); + break; + case MessageContactRegistered.CONSTRUCTOR: + this.content = new MessageContactRegistered(input); + break; + case MessageWebsiteConnected.CONSTRUCTOR: + this.content = new MessageWebsiteConnected(input); + break; + case MessagePassportDataSent.CONSTRUCTOR: + this.content = new MessagePassportDataSent(input); + break; + case MessagePassportDataReceived.CONSTRUCTOR: + this.content = new MessagePassportDataReceived(input); + break; + case MessageUnsupported.CONSTRUCTOR: + this.content = new MessageUnsupported(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class MessageContent extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.senderUserId); + output.writeLong(this.chatId); + if (this.sendingState == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sendingState.serialize(output); + } + if (this.schedulingState == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.schedulingState.serialize(output); + } + output.writeBoolean(this.isOutgoing); + output.writeBoolean(this.canBeEdited); + output.writeBoolean(this.canBeForwarded); + output.writeBoolean(this.canBeDeletedOnlyForSelf); + output.writeBoolean(this.canBeDeletedForAllUsers); + output.writeBoolean(this.isChannelPost); + output.writeBoolean(this.containsUnreadMention); + output.writeInt(this.date); + output.writeInt(this.editDate); + if (this.forwardInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.forwardInfo.serialize(output); + } + output.writeLong(this.replyToMessageId); + output.writeInt(this.ttl); + output.writeDouble(this.ttlExpiresIn); + output.writeInt(this.viaBotUserId); + if (this.authorSignature == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var authorSignatureTmp = this.authorSignature.getBytes(StandardCharsets.UTF_8); + output.writeInt(authorSignatureTmp.length); + output.write(authorSignatureTmp); + } + output.writeInt(this.views); + output.writeLong(this.mediaAlbumId); + if (this.restrictionReason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var restrictionReasonTmp = this.restrictionReason.getBytes(StandardCharsets.UTF_8); + output.writeInt(restrictionReasonTmp.length); + output.write(restrictionReasonTmp); + } + if (this.content == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.content.serialize(output); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + } } public static class MessageText extends MessageContent { public FormattedText text; public WebPage webPage; - public MessageText() { - } + public static final int CONSTRUCTOR = 1989037971; + + public MessageText() {} public MessageText(FormattedText text, WebPage webPage) { this.text = text; this.webPage = webPage; } - public static final int CONSTRUCTOR = 1989037971; + public MessageText(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + if (input.readBoolean()) { + if (WebPage.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.webPage = new WebPage(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.webPage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.webPage.serialize(output); + } + } } public static class MessageAnimation extends MessageContent { @@ -6821,8 +18937,9 @@ public class TdApi { public FormattedText caption; public boolean isSecret; - public MessageAnimation() { - } + public static final int CONSTRUCTOR = 1306939396; + + public MessageAnimation() {} public MessageAnimation(Animation animation, FormattedText caption, boolean isSecret) { this.animation = animation; @@ -6830,52 +18947,140 @@ public class TdApi { this.isSecret = isSecret; } - public static final int CONSTRUCTOR = 1306939396; + public MessageAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new Animation(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + this.isSecret = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.isSecret); + } } public static class MessageAudio extends MessageContent { public Audio audio; public FormattedText caption; - public MessageAudio() { - } + public static final int CONSTRUCTOR = 276722716; + + public MessageAudio() {} public MessageAudio(Audio audio, FormattedText caption) { this.audio = audio; this.caption = caption; } - public static final int CONSTRUCTOR = 276722716; + public MessageAudio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Audio.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.audio = new Audio(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class MessageDocument extends MessageContent { public Document document; public FormattedText caption; - public MessageDocument() { - } + public static final int CONSTRUCTOR = 596945783; + + public MessageDocument() {} public MessageDocument(Document document, FormattedText caption) { this.document = document; this.caption = caption; } - public static final int CONSTRUCTOR = 596945783; + public MessageDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Document.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new Document(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class MessagePhoto extends MessageContent { @@ -6883,8 +19088,9 @@ public class TdApi { public FormattedText caption; public boolean isSecret; - public MessagePhoto() { - } + public static final int CONSTRUCTOR = -1851395174; + + public MessagePhoto() {} public MessagePhoto(Photo photo, FormattedText caption, boolean isSecret) { this.photo = photo; @@ -6892,43 +19098,95 @@ public class TdApi { this.isSecret = isSecret; } - public static final int CONSTRUCTOR = -1851395174; + public MessagePhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + this.isSecret = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.isSecret); + } } public static class MessageExpiredPhoto extends MessageContent { - - public MessageExpiredPhoto() { - } - public static final int CONSTRUCTOR = -1404641801; - @Override + public MessageExpiredPhoto() {} + + + public MessageExpiredPhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageSticker extends MessageContent { public Sticker sticker; - public MessageSticker() { - } + public static final int CONSTRUCTOR = 1779022878; + + public MessageSticker() {} public MessageSticker(Sticker sticker) { this.sticker = sticker; } - public static final int CONSTRUCTOR = 1779022878; + public MessageSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sticker = new Sticker(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class MessageVideo extends MessageContent { @@ -6936,8 +19194,9 @@ public class TdApi { public FormattedText caption; public boolean isSecret; - public MessageVideo() { - } + public static final int CONSTRUCTOR = 2021281344; + + public MessageVideo() {} public MessageVideo(Video video, FormattedText caption, boolean isSecret) { this.video = video; @@ -6945,25 +19204,60 @@ public class TdApi { this.isSecret = isSecret; } - public static final int CONSTRUCTOR = 2021281344; + public MessageVideo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Video.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new Video(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + this.isSecret = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.isSecret); + } } public static class MessageExpiredVideo extends MessageContent { - - public MessageExpiredVideo() { - } - public static final int CONSTRUCTOR = -1212209981; - @Override + public MessageExpiredVideo() {} + + + public MessageExpiredVideo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageVideoNote extends MessageContent { @@ -6971,8 +19265,9 @@ public class TdApi { public boolean isViewed; public boolean isSecret; - public MessageVideoNote() { - } + public static final int CONSTRUCTOR = 963323014; + + public MessageVideoNote() {} public MessageVideoNote(VideoNote videoNote, boolean isViewed, boolean isSecret) { this.videoNote = videoNote; @@ -6980,12 +19275,32 @@ public class TdApi { this.isSecret = isSecret; } - public static final int CONSTRUCTOR = 963323014; + public MessageVideoNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (VideoNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.videoNote = new VideoNote(input); + } + this.isViewed = input.readBoolean(); + this.isSecret = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.videoNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.videoNote.serialize(output); + } + output.writeBoolean(this.isViewed); + output.writeBoolean(this.isSecret); + } } public static class MessageVoiceNote extends MessageContent { @@ -6993,8 +19308,9 @@ public class TdApi { public FormattedText caption; public boolean isListened; - public MessageVoiceNote() { - } + public static final int CONSTRUCTOR = 527777781; + + public MessageVoiceNote() {} public MessageVoiceNote(VoiceNote voiceNote, FormattedText caption, boolean isListened) { this.voiceNote = voiceNote; @@ -7002,12 +19318,42 @@ public class TdApi { this.isListened = isListened; } - public static final int CONSTRUCTOR = 527777781; + public MessageVoiceNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (VoiceNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.voiceNote = new VoiceNote(input); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + this.isListened = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.voiceNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voiceNote.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.isListened); + } } public static class MessageLocation extends MessageContent { @@ -7015,8 +19361,9 @@ public class TdApi { public int livePeriod; public int expiresIn; - public MessageLocation() { - } + public static final int CONSTRUCTOR = -1301887786; + + public MessageLocation() {} public MessageLocation(Location location, int livePeriod, int expiresIn) { this.location = location; @@ -7024,48 +19371,102 @@ public class TdApi { this.expiresIn = expiresIn; } - public static final int CONSTRUCTOR = -1301887786; + public MessageLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + this.livePeriod = input.readInt(); + this.expiresIn = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + output.writeInt(this.livePeriod); + output.writeInt(this.expiresIn); + } } public static class MessageVenue extends MessageContent { public Venue venue; - public MessageVenue() { - } + public static final int CONSTRUCTOR = -2146492043; + + public MessageVenue() {} public MessageVenue(Venue venue) { this.venue = venue; } - public static final int CONSTRUCTOR = -2146492043; + public MessageVenue(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Venue.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.venue = new Venue(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.venue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.venue.serialize(output); + } + } } public static class MessageContact extends MessageContent { public Contact contact; - public MessageContact() { - } + public static final int CONSTRUCTOR = -512684966; + + public MessageContact() {} public MessageContact(Contact contact) { this.contact = contact; } - public static final int CONSTRUCTOR = -512684966; + public MessageContact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contact = new Contact(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.contact == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.contact.serialize(output); + } + } } public static class MessageDice extends MessageContent { @@ -7075,8 +19476,9 @@ public class TdApi { public int value; public int successAnimationFrameNumber; - public MessageDice() { - } + public static final int CONSTRUCTOR = -1350654849; + + public MessageDice() {} public MessageDice(Sticker initialStateSticker, Sticker finalStateSticker, String emoji, int value, int successAnimationFrameNumber) { this.initialStateSticker = initialStateSticker; @@ -7086,48 +19488,127 @@ public class TdApi { this.successAnimationFrameNumber = successAnimationFrameNumber; } - public static final int CONSTRUCTOR = -1350654849; + public MessageDice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.initialStateSticker = new Sticker(input); + } + if (input.readBoolean()) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.finalStateSticker = new Sticker(input); + } + if (input.readBoolean()) { + var emojiTmp = new byte[input.readInt()]; + input.readFully(emojiTmp); + this.emoji = new String(emojiTmp, StandardCharsets.UTF_8); + } + this.value = input.readInt(); + this.successAnimationFrameNumber = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.initialStateSticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.initialStateSticker.serialize(output); + } + if (this.finalStateSticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.finalStateSticker.serialize(output); + } + if (this.emoji == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojiTmp = this.emoji.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojiTmp.length); + output.write(emojiTmp); + } + output.writeInt(this.value); + output.writeInt(this.successAnimationFrameNumber); + } } public static class MessageGame extends MessageContent { public Game game; - public MessageGame() { - } + public static final int CONSTRUCTOR = -69441162; + + public MessageGame() {} public MessageGame(Game game) { this.game = game; } - public static final int CONSTRUCTOR = -69441162; + public MessageGame(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Game.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.game = new Game(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.game == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.game.serialize(output); + } + } } public static class MessagePoll extends MessageContent { public Poll poll; - public MessagePoll() { - } + public static final int CONSTRUCTOR = -662130099; + + public MessagePoll() {} public MessagePoll(Poll poll) { this.poll = poll; } - public static final int CONSTRUCTOR = -662130099; + public MessagePoll(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Poll.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.poll = new Poll(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.poll == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.poll.serialize(output); + } + } } public static class MessageInvoice extends MessageContent { @@ -7141,8 +19622,9 @@ public class TdApi { public boolean needShippingAddress; public long receiptMessageId; - public MessageInvoice() { - } + public static final int CONSTRUCTOR = -1916671476; + + public MessageInvoice() {} public MessageInvoice(String title, String description, Photo photo, String currency, long totalAmount, String startParameter, boolean isTest, boolean needShippingAddress, long receiptMessageId) { this.title = title; @@ -7156,273 +19638,556 @@ public class TdApi { this.receiptMessageId = receiptMessageId; } - public static final int CONSTRUCTOR = -1916671476; + public MessageInvoice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + var currencyTmp = new byte[input.readInt()]; + input.readFully(currencyTmp); + this.currency = new String(currencyTmp, StandardCharsets.UTF_8); + } + this.totalAmount = input.readLong(); + if (input.readBoolean()) { + var startParameterTmp = new byte[input.readInt()]; + input.readFully(startParameterTmp); + this.startParameter = new String(startParameterTmp, StandardCharsets.UTF_8); + } + this.isTest = input.readBoolean(); + this.needShippingAddress = input.readBoolean(); + this.receiptMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.currency == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var currencyTmp = this.currency.getBytes(StandardCharsets.UTF_8); + output.writeInt(currencyTmp.length); + output.write(currencyTmp); + } + output.writeLong(this.totalAmount); + if (this.startParameter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var startParameterTmp = this.startParameter.getBytes(StandardCharsets.UTF_8); + output.writeInt(startParameterTmp.length); + output.write(startParameterTmp); + } + output.writeBoolean(this.isTest); + output.writeBoolean(this.needShippingAddress); + output.writeLong(this.receiptMessageId); + } } public static class MessageCall extends MessageContent { public CallDiscardReason discardReason; public int duration; - public MessageCall() { - } + public static final int CONSTRUCTOR = 366512596; + + public MessageCall() {} public MessageCall(CallDiscardReason discardReason, int duration) { this.discardReason = discardReason; this.duration = duration; } - public static final int CONSTRUCTOR = 366512596; + public MessageCall(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case CallDiscardReasonEmpty.CONSTRUCTOR: + this.discardReason = new CallDiscardReasonEmpty(input); + break; + case CallDiscardReasonMissed.CONSTRUCTOR: + this.discardReason = new CallDiscardReasonMissed(input); + break; + case CallDiscardReasonDeclined.CONSTRUCTOR: + this.discardReason = new CallDiscardReasonDeclined(input); + break; + case CallDiscardReasonDisconnected.CONSTRUCTOR: + this.discardReason = new CallDiscardReasonDisconnected(input); + break; + case CallDiscardReasonHungUp.CONSTRUCTOR: + this.discardReason = new CallDiscardReasonHungUp(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.duration = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.discardReason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.discardReason.serialize(output); + } + output.writeInt(this.duration); + } } public static class MessageBasicGroupChatCreate extends MessageContent { public String title; public int[] memberUserIds; - public MessageBasicGroupChatCreate() { - } + public static final int CONSTRUCTOR = 1575377646; + + public MessageBasicGroupChatCreate() {} public MessageBasicGroupChatCreate(String title, int[] memberUserIds) { this.title = title; this.memberUserIds = memberUserIds; } - public static final int CONSTRUCTOR = 1575377646; + public MessageBasicGroupChatCreate(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.memberUserIds = new int[input.readInt()]; + for (int i = 0; i < this.memberUserIds.length; i++) { + this.memberUserIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeInt(this.memberUserIds.length); + for (int i = 0; i < this.memberUserIds.length; i++) { + output.writeInt(this.memberUserIds[i]); + } + } } public static class MessageSupergroupChatCreate extends MessageContent { public String title; - public MessageSupergroupChatCreate() { - } + public static final int CONSTRUCTOR = -434325733; + + public MessageSupergroupChatCreate() {} public MessageSupergroupChatCreate(String title) { this.title = title; } - public static final int CONSTRUCTOR = -434325733; + public MessageSupergroupChatCreate(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class MessageChatChangeTitle extends MessageContent { public String title; - public MessageChatChangeTitle() { - } + public static final int CONSTRUCTOR = 748272449; + + public MessageChatChangeTitle() {} public MessageChatChangeTitle(String title) { this.title = title; } - public static final int CONSTRUCTOR = 748272449; + public MessageChatChangeTitle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class MessageChatChangePhoto extends MessageContent { public Photo photo; - public MessageChatChangePhoto() { - } + public static final int CONSTRUCTOR = 319630249; + + public MessageChatChangePhoto() {} public MessageChatChangePhoto(Photo photo) { this.photo = photo; } - public static final int CONSTRUCTOR = 319630249; + public MessageChatChangePhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + } } public static class MessageChatDeletePhoto extends MessageContent { - - public MessageChatDeletePhoto() { - } - public static final int CONSTRUCTOR = -184374809; - @Override + public MessageChatDeletePhoto() {} + + + public MessageChatDeletePhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageChatAddMembers extends MessageContent { public int[] memberUserIds; - public MessageChatAddMembers() { - } + public static final int CONSTRUCTOR = 401228326; + + public MessageChatAddMembers() {} public MessageChatAddMembers(int[] memberUserIds) { this.memberUserIds = memberUserIds; } - public static final int CONSTRUCTOR = 401228326; + public MessageChatAddMembers(DataInputStream input) throws IOException { + this.memberUserIds = new int[input.readInt()]; + for (int i = 0; i < this.memberUserIds.length; i++) { + this.memberUserIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.memberUserIds.length); + for (int i = 0; i < this.memberUserIds.length; i++) { + output.writeInt(this.memberUserIds[i]); + } + } } public static class MessageChatJoinByLink extends MessageContent { - - public MessageChatJoinByLink() { - } - public static final int CONSTRUCTOR = 1846493311; - @Override + public MessageChatJoinByLink() {} + + + public MessageChatJoinByLink(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageChatDeleteMember extends MessageContent { public int userId; - public MessageChatDeleteMember() { - } + public static final int CONSTRUCTOR = 1164414043; + + public MessageChatDeleteMember() {} public MessageChatDeleteMember(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = 1164414043; + public MessageChatDeleteMember(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class MessageChatUpgradeTo extends MessageContent { public int supergroupId; - public MessageChatUpgradeTo() { - } + public static final int CONSTRUCTOR = 1957816681; + + public MessageChatUpgradeTo() {} public MessageChatUpgradeTo(int supergroupId) { this.supergroupId = supergroupId; } - public static final int CONSTRUCTOR = 1957816681; + public MessageChatUpgradeTo(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + } } public static class MessageChatUpgradeFrom extends MessageContent { public String title; public int basicGroupId; - public MessageChatUpgradeFrom() { - } + public static final int CONSTRUCTOR = 1642272558; + + public MessageChatUpgradeFrom() {} public MessageChatUpgradeFrom(String title, int basicGroupId) { this.title = title; this.basicGroupId = basicGroupId; } - public static final int CONSTRUCTOR = 1642272558; + public MessageChatUpgradeFrom(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.basicGroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeInt(this.basicGroupId); + } } public static class MessagePinMessage extends MessageContent { public long messageId; - public MessagePinMessage() { - } + public static final int CONSTRUCTOR = 953503801; + + public MessagePinMessage() {} public MessagePinMessage(long messageId) { this.messageId = messageId; } - public static final int CONSTRUCTOR = 953503801; + public MessagePinMessage(DataInputStream input) throws IOException { + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.messageId); + } } public static class MessageScreenshotTaken extends MessageContent { - - public MessageScreenshotTaken() { - } - public static final int CONSTRUCTOR = -1564971605; - @Override + public MessageScreenshotTaken() {} + + + public MessageScreenshotTaken(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageChatSetTtl extends MessageContent { public int ttl; - public MessageChatSetTtl() { - } + public static final int CONSTRUCTOR = 1810060209; + + public MessageChatSetTtl() {} public MessageChatSetTtl(int ttl) { this.ttl = ttl; } - public static final int CONSTRUCTOR = 1810060209; + public MessageChatSetTtl(DataInputStream input) throws IOException { + this.ttl = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.ttl); + } } public static class MessageCustomServiceAction extends MessageContent { public String text; - public MessageCustomServiceAction() { - } + public static final int CONSTRUCTOR = 1435879282; + + public MessageCustomServiceAction() {} public MessageCustomServiceAction(String text) { this.text = text; } - public static final int CONSTRUCTOR = 1435879282; + public MessageCustomServiceAction(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + } } public static class MessageGameScore extends MessageContent { @@ -7430,8 +20195,9 @@ public class TdApi { public long gameId; public int score; - public MessageGameScore() { - } + public static final int CONSTRUCTOR = 1344904575; + + public MessageGameScore() {} public MessageGameScore(long gameMessageId, long gameId, int score) { this.gameMessageId = gameMessageId; @@ -7439,12 +20205,22 @@ public class TdApi { this.score = score; } - public static final int CONSTRUCTOR = 1344904575; + public MessageGameScore(DataInputStream input) throws IOException { + this.gameMessageId = input.readLong(); + this.gameId = input.readLong(); + this.score = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.gameMessageId); + output.writeLong(this.gameId); + output.writeInt(this.score); + } } public static class MessagePaymentSuccessful extends MessageContent { @@ -7452,8 +20228,9 @@ public class TdApi { public String currency; public long totalAmount; - public MessagePaymentSuccessful() { - } + public static final int CONSTRUCTOR = -595962993; + + public MessagePaymentSuccessful() {} public MessagePaymentSuccessful(long invoiceMessageId, String currency, long totalAmount) { this.invoiceMessageId = invoiceMessageId; @@ -7461,12 +20238,33 @@ public class TdApi { this.totalAmount = totalAmount; } - public static final int CONSTRUCTOR = -595962993; + public MessagePaymentSuccessful(DataInputStream input) throws IOException { + this.invoiceMessageId = input.readLong(); + if (input.readBoolean()) { + var currencyTmp = new byte[input.readInt()]; + input.readFully(currencyTmp); + this.currency = new String(currencyTmp, StandardCharsets.UTF_8); + } + this.totalAmount = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.invoiceMessageId); + if (this.currency == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var currencyTmp = this.currency.getBytes(StandardCharsets.UTF_8); + output.writeInt(currencyTmp.length); + output.write(currencyTmp); + } + output.writeLong(this.totalAmount); + } } public static class MessagePaymentSuccessfulBot extends MessageContent { @@ -7479,8 +20277,9 @@ public class TdApi { public String telegramPaymentChargeId; public String providerPaymentChargeId; - public MessagePaymentSuccessfulBot() { - } + public static final int CONSTRUCTOR = -412310696; + + public MessagePaymentSuccessfulBot() {} public MessagePaymentSuccessfulBot(long invoiceMessageId, String currency, long totalAmount, byte[] invoicePayload, String shippingOptionId, OrderInfo orderInfo, String telegramPaymentChargeId, String providerPaymentChargeId) { this.invoiceMessageId = invoiceMessageId; @@ -7493,94 +20292,281 @@ public class TdApi { this.providerPaymentChargeId = providerPaymentChargeId; } - public static final int CONSTRUCTOR = -412310696; + public MessagePaymentSuccessfulBot(DataInputStream input) throws IOException { + this.invoiceMessageId = input.readLong(); + if (input.readBoolean()) { + var currencyTmp = new byte[input.readInt()]; + input.readFully(currencyTmp); + this.currency = new String(currencyTmp, StandardCharsets.UTF_8); + } + this.totalAmount = input.readLong(); + this.invoicePayload = new byte[input.readInt()]; + input.readFully(this.invoicePayload); + if (input.readBoolean()) { + var shippingOptionIdTmp = new byte[input.readInt()]; + input.readFully(shippingOptionIdTmp); + this.shippingOptionId = new String(shippingOptionIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (OrderInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.orderInfo = new OrderInfo(input); + } + if (input.readBoolean()) { + var telegramPaymentChargeIdTmp = new byte[input.readInt()]; + input.readFully(telegramPaymentChargeIdTmp); + this.telegramPaymentChargeId = new String(telegramPaymentChargeIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var providerPaymentChargeIdTmp = new byte[input.readInt()]; + input.readFully(providerPaymentChargeIdTmp); + this.providerPaymentChargeId = new String(providerPaymentChargeIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.invoiceMessageId); + if (this.currency == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var currencyTmp = this.currency.getBytes(StandardCharsets.UTF_8); + output.writeInt(currencyTmp.length); + output.write(currencyTmp); + } + output.writeLong(this.totalAmount); + output.writeInt(this.invoicePayload.length); + output.write(this.invoicePayload); + if (this.shippingOptionId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var shippingOptionIdTmp = this.shippingOptionId.getBytes(StandardCharsets.UTF_8); + output.writeInt(shippingOptionIdTmp.length); + output.write(shippingOptionIdTmp); + } + if (this.orderInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.orderInfo.serialize(output); + } + if (this.telegramPaymentChargeId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var telegramPaymentChargeIdTmp = this.telegramPaymentChargeId.getBytes(StandardCharsets.UTF_8); + output.writeInt(telegramPaymentChargeIdTmp.length); + output.write(telegramPaymentChargeIdTmp); + } + if (this.providerPaymentChargeId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var providerPaymentChargeIdTmp = this.providerPaymentChargeId.getBytes(StandardCharsets.UTF_8); + output.writeInt(providerPaymentChargeIdTmp.length); + output.write(providerPaymentChargeIdTmp); + } + } } public static class MessageContactRegistered extends MessageContent { - - public MessageContactRegistered() { - } - public static final int CONSTRUCTOR = -1502020353; - @Override + public MessageContactRegistered() {} + + + public MessageContactRegistered(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageWebsiteConnected extends MessageContent { public String domainName; - public MessageWebsiteConnected() { - } + public static final int CONSTRUCTOR = -1074551800; + + public MessageWebsiteConnected() {} public MessageWebsiteConnected(String domainName) { this.domainName = domainName; } - public static final int CONSTRUCTOR = -1074551800; + public MessageWebsiteConnected(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var domainNameTmp = new byte[input.readInt()]; + input.readFully(domainNameTmp); + this.domainName = new String(domainNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.domainName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var domainNameTmp = this.domainName.getBytes(StandardCharsets.UTF_8); + output.writeInt(domainNameTmp.length); + output.write(domainNameTmp); + } + } } public static class MessagePassportDataSent extends MessageContent { public PassportElementType[] types; - public MessagePassportDataSent() { - } + public static final int CONSTRUCTOR = 1017405171; + + public MessagePassportDataSent() {} public MessagePassportDataSent(PassportElementType[] types) { this.types = types; } - public static final int CONSTRUCTOR = 1017405171; + public MessagePassportDataSent(DataInputStream input) throws IOException { + this.types = new PassportElementType[input.readInt()]; + for (int i = 0; i < this.types.length; i++) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.types[i] = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.types[i] = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.types[i] = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.types[i] = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.types[i] = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.types[i] = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.types[i] = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.types[i] = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.types[i] = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.types[i] = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.types[i] = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.types[i] = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.types[i] = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.types.length); + for (int i = 0; i < this.types.length; i++) { + this.types[i].serialize(output); + } + } } public static class MessagePassportDataReceived extends MessageContent { public EncryptedPassportElement[] elements; public EncryptedCredentials credentials; - public MessagePassportDataReceived() { - } + public static final int CONSTRUCTOR = -1367863624; + + public MessagePassportDataReceived() {} public MessagePassportDataReceived(EncryptedPassportElement[] elements, EncryptedCredentials credentials) { this.elements = elements; this.credentials = credentials; } - public static final int CONSTRUCTOR = -1367863624; + public MessagePassportDataReceived(DataInputStream input) throws IOException { + this.elements = new EncryptedPassportElement[input.readInt()]; + for (int i = 0; i < this.elements.length; i++) { + if (EncryptedPassportElement.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.elements[i] = new EncryptedPassportElement(input); + } + if (input.readBoolean()) { + if (EncryptedCredentials.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.credentials = new EncryptedCredentials(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.elements.length); + for (int i = 0; i < this.elements.length; i++) { + this.elements[i].serialize(output); + } + if (this.credentials == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.credentials.serialize(output); + } + } } public static class MessageUnsupported extends MessageContent { - - public MessageUnsupported() { - } - public static final int CONSTRUCTOR = -1816726139; - @Override + public MessageUnsupported() {} + + + public MessageUnsupported(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageForwardInfo extends Object { @@ -7589,8 +20575,9 @@ public class TdApi { public long fromChatId; public long fromMessageId; - public MessageForwardInfo() { - } + public static final int CONSTRUCTOR = -1622371186; + + public MessageForwardInfo() {} public MessageForwardInfo(MessageForwardOrigin origin, int date, long fromChatId, long fromMessageId) { this.origin = origin; @@ -7599,51 +20586,104 @@ public class TdApi { this.fromMessageId = fromMessageId; } - public static final int CONSTRUCTOR = -1622371186; + public MessageForwardInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageForwardOriginUser.CONSTRUCTOR: + this.origin = new MessageForwardOriginUser(input); + break; + case MessageForwardOriginHiddenUser.CONSTRUCTOR: + this.origin = new MessageForwardOriginHiddenUser(input); + break; + case MessageForwardOriginChannel.CONSTRUCTOR: + this.origin = new MessageForwardOriginChannel(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.date = input.readInt(); + this.fromChatId = input.readLong(); + this.fromMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class MessageForwardOrigin extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.origin == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.origin.serialize(output); + } + output.writeInt(this.date); + output.writeLong(this.fromChatId); + output.writeLong(this.fromMessageId); + } } public static class MessageForwardOriginUser extends MessageForwardOrigin { public int senderUserId; - public MessageForwardOriginUser() { - } + public static final int CONSTRUCTOR = 2781520; + + public MessageForwardOriginUser() {} public MessageForwardOriginUser(int senderUserId) { this.senderUserId = senderUserId; } - public static final int CONSTRUCTOR = 2781520; + public MessageForwardOriginUser(DataInputStream input) throws IOException { + this.senderUserId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.senderUserId); + } } public static class MessageForwardOriginHiddenUser extends MessageForwardOrigin { public String senderName; - public MessageForwardOriginHiddenUser() { - } + public static final int CONSTRUCTOR = -271257885; + + public MessageForwardOriginHiddenUser() {} public MessageForwardOriginHiddenUser(String senderName) { this.senderName = senderName; } - public static final int CONSTRUCTOR = -271257885; + public MessageForwardOriginHiddenUser(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var senderNameTmp = new byte[input.readInt()]; + input.readFully(senderNameTmp); + this.senderName = new String(senderNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.senderName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var senderNameTmp = this.senderName.getBytes(StandardCharsets.UTF_8); + output.writeInt(senderNameTmp.length); + output.write(senderNameTmp); + } + } } public static class MessageForwardOriginChannel extends MessageForwardOrigin { @@ -7651,8 +20691,9 @@ public class TdApi { public long messageId; public String authorSignature; - public MessageForwardOriginChannel() { - } + public static final int CONSTRUCTOR = 1490730723; + + public MessageForwardOriginChannel() {} public MessageForwardOriginChannel(long chatId, long messageId, String authorSignature) { this.chatId = chatId; @@ -7660,12 +20701,33 @@ public class TdApi { this.authorSignature = authorSignature; } - public static final int CONSTRUCTOR = 1490730723; + public MessageForwardOriginChannel(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + var authorSignatureTmp = new byte[input.readInt()]; + input.readFully(authorSignatureTmp); + this.authorSignature = new String(authorSignatureTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.authorSignature == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var authorSignatureTmp = this.authorSignature.getBytes(StandardCharsets.UTF_8); + output.writeInt(authorSignatureTmp.length); + output.write(authorSignatureTmp); + } + } } public static class MessageLinkInfo extends Object { @@ -7674,8 +20736,9 @@ public class TdApi { public Message message; public boolean forAlbum; - public MessageLinkInfo() { - } + public static final int CONSTRUCTOR = 657372995; + + public MessageLinkInfo() {} public MessageLinkInfo(boolean isPublic, long chatId, Message message, boolean forAlbum) { this.isPublic = isPublic; @@ -7684,62 +20747,95 @@ public class TdApi { this.forAlbum = forAlbum; } - public static final int CONSTRUCTOR = 657372995; + public MessageLinkInfo(DataInputStream input) throws IOException { + this.isPublic = input.readBoolean(); + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + this.forAlbum = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class MessageSchedulingState extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isPublic); + output.writeLong(this.chatId); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + output.writeBoolean(this.forAlbum); + } } public static class MessageSchedulingStateSendAtDate extends MessageSchedulingState { public int sendDate; - public MessageSchedulingStateSendAtDate() { - } + public static final int CONSTRUCTOR = -1485570073; + + public MessageSchedulingStateSendAtDate() {} public MessageSchedulingStateSendAtDate(int sendDate) { this.sendDate = sendDate; } - public static final int CONSTRUCTOR = -1485570073; + public MessageSchedulingStateSendAtDate(DataInputStream input) throws IOException { + this.sendDate = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.sendDate); + } } public static class MessageSchedulingStateSendWhenOnline extends MessageSchedulingState { - - public MessageSchedulingStateSendWhenOnline() { - } - public static final int CONSTRUCTOR = 2092947464; - @Override + public MessageSchedulingStateSendWhenOnline() {} + + + public MessageSchedulingStateSendWhenOnline(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class MessageSendingState extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageSendingStatePending extends MessageSendingState { - - public MessageSendingStatePending() { - } - public static final int CONSTRUCTOR = -1381803582; - @Override + public MessageSendingStatePending() {} + + + public MessageSendingStatePending(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class MessageSendingStateFailed extends MessageSendingState { @@ -7748,8 +20844,9 @@ public class TdApi { public boolean canRetry; public double retryAfter; - public MessageSendingStateFailed() { - } + public static final int CONSTRUCTOR = 2054476087; + + public MessageSendingStateFailed() {} public MessageSendingStateFailed(int errorCode, String errorMessage, boolean canRetry, double retryAfter) { this.errorCode = errorCode; @@ -7758,32 +20855,73 @@ public class TdApi { this.retryAfter = retryAfter; } - public static final int CONSTRUCTOR = 2054476087; + public MessageSendingStateFailed(DataInputStream input) throws IOException { + this.errorCode = input.readInt(); + if (input.readBoolean()) { + var errorMessageTmp = new byte[input.readInt()]; + input.readFully(errorMessageTmp); + this.errorMessage = new String(errorMessageTmp, StandardCharsets.UTF_8); + } + this.canRetry = input.readBoolean(); + this.retryAfter = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.errorCode); + if (this.errorMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var errorMessageTmp = this.errorMessage.getBytes(StandardCharsets.UTF_8); + output.writeInt(errorMessageTmp.length); + output.write(errorMessageTmp); + } + output.writeBoolean(this.canRetry); + output.writeDouble(this.retryAfter); + } } public static class Messages extends Object { public int totalCount; public Message[] messages; - public Messages() { - } + public static final int CONSTRUCTOR = -16498159; + + public Messages() {} public Messages(int totalCount, Message[] messages) { this.totalCount = totalCount; this.messages = messages; } - public static final int CONSTRUCTOR = -16498159; + public Messages(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + this.messages = new Message[input.readInt()]; + for (int i = 0; i < this.messages.length; i++) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.messages[i] = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + output.writeInt(this.messages.length); + for (int i = 0; i < this.messages.length; i++) { + this.messages[i].serialize(output); + } + } } public static class Minithumbnail extends Object { @@ -7791,8 +20929,9 @@ public class TdApi { public int height; public byte[] data; - public Minithumbnail() { - } + public static final int CONSTRUCTOR = -328540758; + + public Minithumbnail() {} public Minithumbnail(int width, int height, byte[] data) { this.width = width; @@ -7800,35 +20939,68 @@ public class TdApi { this.data = data; } - public static final int CONSTRUCTOR = -328540758; + public Minithumbnail(DataInputStream input) throws IOException { + this.width = input.readInt(); + this.height = input.readInt(); + this.data = new byte[input.readInt()]; + input.readFully(this.data); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.width); + output.writeInt(this.height); + output.writeInt(this.data.length); + output.write(this.data); + } } public static class NetworkStatistics extends Object { public int sinceDate; public NetworkStatisticsEntry[] entries; - public NetworkStatistics() { - } + public static final int CONSTRUCTOR = 1615554212; + + public NetworkStatistics() {} public NetworkStatistics(int sinceDate, NetworkStatisticsEntry[] entries) { this.sinceDate = sinceDate; this.entries = entries; } - public static final int CONSTRUCTOR = 1615554212; + public NetworkStatistics(DataInputStream input) throws IOException { + this.sinceDate = input.readInt(); + this.entries = new NetworkStatisticsEntry[input.readInt()]; + for (int i = 0; i < this.entries.length; i++) { + switch(input.readInt()) { + case NetworkStatisticsEntryFile.CONSTRUCTOR: + this.entries[i] = new NetworkStatisticsEntryFile(input); + break; + case NetworkStatisticsEntryCall.CONSTRUCTOR: + this.entries[i] = new NetworkStatisticsEntryCall(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class NetworkStatisticsEntry extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.sinceDate); + output.writeInt(this.entries.length); + for (int i = 0; i < this.entries.length; i++) { + this.entries[i].serialize(output); + } + } } public static class NetworkStatisticsEntryFile extends NetworkStatisticsEntry { @@ -7837,8 +21009,9 @@ public class TdApi { public long sentBytes; public long receivedBytes; - public NetworkStatisticsEntryFile() { - } + public static final int CONSTRUCTOR = 188452706; + + public NetworkStatisticsEntryFile() {} public NetworkStatisticsEntryFile(FileType fileType, NetworkType networkType, long sentBytes, long receivedBytes) { this.fileType = fileType; @@ -7847,12 +21020,107 @@ public class TdApi { this.receivedBytes = receivedBytes; } - public static final int CONSTRUCTOR = 188452706; + public NetworkStatisticsEntryFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case FileTypeNone.CONSTRUCTOR: + this.fileType = new FileTypeNone(input); + break; + case FileTypeAnimation.CONSTRUCTOR: + this.fileType = new FileTypeAnimation(input); + break; + case FileTypeAudio.CONSTRUCTOR: + this.fileType = new FileTypeAudio(input); + break; + case FileTypeDocument.CONSTRUCTOR: + this.fileType = new FileTypeDocument(input); + break; + case FileTypePhoto.CONSTRUCTOR: + this.fileType = new FileTypePhoto(input); + break; + case FileTypeProfilePhoto.CONSTRUCTOR: + this.fileType = new FileTypeProfilePhoto(input); + break; + case FileTypeSecret.CONSTRUCTOR: + this.fileType = new FileTypeSecret(input); + break; + case FileTypeSecretThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeSecretThumbnail(input); + break; + case FileTypeSecure.CONSTRUCTOR: + this.fileType = new FileTypeSecure(input); + break; + case FileTypeSticker.CONSTRUCTOR: + this.fileType = new FileTypeSticker(input); + break; + case FileTypeThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeThumbnail(input); + break; + case FileTypeUnknown.CONSTRUCTOR: + this.fileType = new FileTypeUnknown(input); + break; + case FileTypeVideo.CONSTRUCTOR: + this.fileType = new FileTypeVideo(input); + break; + case FileTypeVideoNote.CONSTRUCTOR: + this.fileType = new FileTypeVideoNote(input); + break; + case FileTypeVoiceNote.CONSTRUCTOR: + this.fileType = new FileTypeVoiceNote(input); + break; + case FileTypeWallpaper.CONSTRUCTOR: + this.fileType = new FileTypeWallpaper(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case NetworkTypeNone.CONSTRUCTOR: + this.networkType = new NetworkTypeNone(input); + break; + case NetworkTypeMobile.CONSTRUCTOR: + this.networkType = new NetworkTypeMobile(input); + break; + case NetworkTypeMobileRoaming.CONSTRUCTOR: + this.networkType = new NetworkTypeMobileRoaming(input); + break; + case NetworkTypeWiFi.CONSTRUCTOR: + this.networkType = new NetworkTypeWiFi(input); + break; + case NetworkTypeOther.CONSTRUCTOR: + this.networkType = new NetworkTypeOther(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.sentBytes = input.readLong(); + this.receivedBytes = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fileType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.fileType.serialize(output); + } + if (this.networkType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.networkType.serialize(output); + } + output.writeLong(this.sentBytes); + output.writeLong(this.receivedBytes); + } } public static class NetworkStatisticsEntryCall extends NetworkStatisticsEntry { @@ -7861,8 +21129,9 @@ public class TdApi { public long receivedBytes; public double duration; - public NetworkStatisticsEntryCall() { - } + public static final int CONSTRUCTOR = 737000365; + + public NetworkStatisticsEntryCall() {} public NetworkStatisticsEntryCall(NetworkType networkType, long sentBytes, long receivedBytes, double duration) { this.networkType = networkType; @@ -7871,80 +21140,139 @@ public class TdApi { this.duration = duration; } - public static final int CONSTRUCTOR = 737000365; + public NetworkStatisticsEntryCall(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NetworkTypeNone.CONSTRUCTOR: + this.networkType = new NetworkTypeNone(input); + break; + case NetworkTypeMobile.CONSTRUCTOR: + this.networkType = new NetworkTypeMobile(input); + break; + case NetworkTypeMobileRoaming.CONSTRUCTOR: + this.networkType = new NetworkTypeMobileRoaming(input); + break; + case NetworkTypeWiFi.CONSTRUCTOR: + this.networkType = new NetworkTypeWiFi(input); + break; + case NetworkTypeOther.CONSTRUCTOR: + this.networkType = new NetworkTypeOther(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.sentBytes = input.readLong(); + this.receivedBytes = input.readLong(); + this.duration = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class NetworkType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.networkType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.networkType.serialize(output); + } + output.writeLong(this.sentBytes); + output.writeLong(this.receivedBytes); + output.writeDouble(this.duration); + } } public static class NetworkTypeNone extends NetworkType { - - public NetworkTypeNone() { - } - public static final int CONSTRUCTOR = -1971691759; - @Override + public NetworkTypeNone() {} + + + public NetworkTypeNone(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NetworkTypeMobile extends NetworkType { - - public NetworkTypeMobile() { - } - public static final int CONSTRUCTOR = 819228239; - @Override + public NetworkTypeMobile() {} + + + public NetworkTypeMobile(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NetworkTypeMobileRoaming extends NetworkType { - - public NetworkTypeMobileRoaming() { - } - public static final int CONSTRUCTOR = -1435199760; - @Override + public NetworkTypeMobileRoaming() {} + + + public NetworkTypeMobileRoaming(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NetworkTypeWiFi extends NetworkType { - - public NetworkTypeWiFi() { - } - public static final int CONSTRUCTOR = -633872070; - @Override + public NetworkTypeWiFi() {} + + + public NetworkTypeWiFi(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NetworkTypeOther extends NetworkType { - - public NetworkTypeOther() { - } - public static final int CONSTRUCTOR = 1942128539; - @Override + public NetworkTypeOther() {} + + + public NetworkTypeOther(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class Notification extends Object { @@ -7953,8 +21281,9 @@ public class TdApi { public boolean isSilent; public NotificationType type; - public Notification() { - } + public static final int CONSTRUCTOR = 788743120; + + public Notification() {} public Notification(int id, int date, boolean isSilent, NotificationType type) { this.id = id; @@ -7963,12 +21292,46 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = 788743120; + public Notification(DataInputStream input) throws IOException { + this.id = input.readInt(); + this.date = input.readInt(); + this.isSilent = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationTypeNewMessage.CONSTRUCTOR: + this.type = new NotificationTypeNewMessage(input); + break; + case NotificationTypeNewSecretChat.CONSTRUCTOR: + this.type = new NotificationTypeNewSecretChat(input); + break; + case NotificationTypeNewCall.CONSTRUCTOR: + this.type = new NotificationTypeNewCall(input); + break; + case NotificationTypeNewPushMessage.CONSTRUCTOR: + this.type = new NotificationTypeNewPushMessage(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + output.writeInt(this.date); + output.writeBoolean(this.isSilent); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class NotificationGroup extends Object { @@ -7978,8 +21341,9 @@ public class TdApi { public int totalCount; public Notification[] notifications; - public NotificationGroup() { - } + public static final int CONSTRUCTOR = 780691541; + + public NotificationGroup() {} public NotificationGroup(int id, NotificationGroupType type, long chatId, int totalCount, Notification[] notifications) { this.id = id; @@ -7989,161 +21353,261 @@ public class TdApi { this.notifications = notifications; } - public static final int CONSTRUCTOR = 780691541; + public NotificationGroup(DataInputStream input) throws IOException { + this.id = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationGroupTypeMessages.CONSTRUCTOR: + this.type = new NotificationGroupTypeMessages(input); + break; + case NotificationGroupTypeMentions.CONSTRUCTOR: + this.type = new NotificationGroupTypeMentions(input); + break; + case NotificationGroupTypeSecretChat.CONSTRUCTOR: + this.type = new NotificationGroupTypeSecretChat(input); + break; + case NotificationGroupTypeCalls.CONSTRUCTOR: + this.type = new NotificationGroupTypeCalls(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.chatId = input.readLong(); + this.totalCount = input.readInt(); + this.notifications = new Notification[input.readInt()]; + for (int i = 0; i < this.notifications.length; i++) { + if (Notification.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notifications[i] = new Notification(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class NotificationGroupType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeLong(this.chatId); + output.writeInt(this.totalCount); + output.writeInt(this.notifications.length); + for (int i = 0; i < this.notifications.length; i++) { + this.notifications[i].serialize(output); + } + } } public static class NotificationGroupTypeMessages extends NotificationGroupType { - - public NotificationGroupTypeMessages() { - } - public static final int CONSTRUCTOR = -1702481123; - @Override + public NotificationGroupTypeMessages() {} + + + public NotificationGroupTypeMessages(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationGroupTypeMentions extends NotificationGroupType { - - public NotificationGroupTypeMentions() { - } - public static final int CONSTRUCTOR = -2050324051; - @Override + public NotificationGroupTypeMentions() {} + + + public NotificationGroupTypeMentions(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationGroupTypeSecretChat extends NotificationGroupType { - - public NotificationGroupTypeSecretChat() { - } - public static final int CONSTRUCTOR = 1390759476; - @Override + public NotificationGroupTypeSecretChat() {} + + + public NotificationGroupTypeSecretChat(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationGroupTypeCalls extends NotificationGroupType { - - public NotificationGroupTypeCalls() { - } - public static final int CONSTRUCTOR = 1379123538; - @Override + public NotificationGroupTypeCalls() {} + + + public NotificationGroupTypeCalls(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class NotificationSettingsScope extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationSettingsScopePrivateChats extends NotificationSettingsScope { - - public NotificationSettingsScopePrivateChats() { - } - public static final int CONSTRUCTOR = 937446759; - @Override + public NotificationSettingsScopePrivateChats() {} + + + public NotificationSettingsScopePrivateChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationSettingsScopeGroupChats extends NotificationSettingsScope { - - public NotificationSettingsScopeGroupChats() { - } - public static final int CONSTRUCTOR = 1212142067; - @Override + public NotificationSettingsScopeGroupChats() {} + + + public NotificationSettingsScopeGroupChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationSettingsScopeChannelChats extends NotificationSettingsScope { - - public NotificationSettingsScopeChannelChats() { - } - public static final int CONSTRUCTOR = 548013448; - @Override + public NotificationSettingsScopeChannelChats() {} + + + public NotificationSettingsScopeChannelChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class NotificationType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationTypeNewMessage extends NotificationType { public Message message; - public NotificationTypeNewMessage() { - } + public static final int CONSTRUCTOR = 1885935159; + + public NotificationTypeNewMessage() {} public NotificationTypeNewMessage(Message message) { this.message = message; } - public static final int CONSTRUCTOR = 1885935159; + public NotificationTypeNewMessage(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + } } public static class NotificationTypeNewSecretChat extends NotificationType { - - public NotificationTypeNewSecretChat() { - } - public static final int CONSTRUCTOR = 1198638768; - @Override + public NotificationTypeNewSecretChat() {} + + + public NotificationTypeNewSecretChat(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class NotificationTypeNewCall extends NotificationType { public int callId; - public NotificationTypeNewCall() { - } + public static final int CONSTRUCTOR = 1712734585; + + public NotificationTypeNewCall() {} public NotificationTypeNewCall(int callId) { this.callId = callId; } - public static final int CONSTRUCTOR = 1712734585; + public NotificationTypeNewCall(DataInputStream input) throws IOException { + this.callId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.callId); + } } public static class NotificationTypeNewPushMessage extends NotificationType { @@ -8153,8 +21617,9 @@ public class TdApi { public boolean isOutgoing; public PushMessageContent content; - public NotificationTypeNewPushMessage() { - } + public static final int CONSTRUCTOR = 999250657; + + public NotificationTypeNewPushMessage() {} public NotificationTypeNewPushMessage(long messageId, int senderUserId, String senderName, boolean isOutgoing, PushMessageContent content) { this.messageId = messageId; @@ -8164,95 +21629,247 @@ public class TdApi { this.content = content; } - public static final int CONSTRUCTOR = 999250657; + public NotificationTypeNewPushMessage(DataInputStream input) throws IOException { + this.messageId = input.readLong(); + this.senderUserId = input.readInt(); + if (input.readBoolean()) { + var senderNameTmp = new byte[input.readInt()]; + input.readFully(senderNameTmp); + this.senderName = new String(senderNameTmp, StandardCharsets.UTF_8); + } + this.isOutgoing = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case PushMessageContentHidden.CONSTRUCTOR: + this.content = new PushMessageContentHidden(input); + break; + case PushMessageContentAnimation.CONSTRUCTOR: + this.content = new PushMessageContentAnimation(input); + break; + case PushMessageContentAudio.CONSTRUCTOR: + this.content = new PushMessageContentAudio(input); + break; + case PushMessageContentContact.CONSTRUCTOR: + this.content = new PushMessageContentContact(input); + break; + case PushMessageContentContactRegistered.CONSTRUCTOR: + this.content = new PushMessageContentContactRegistered(input); + break; + case PushMessageContentDocument.CONSTRUCTOR: + this.content = new PushMessageContentDocument(input); + break; + case PushMessageContentGame.CONSTRUCTOR: + this.content = new PushMessageContentGame(input); + break; + case PushMessageContentGameScore.CONSTRUCTOR: + this.content = new PushMessageContentGameScore(input); + break; + case PushMessageContentInvoice.CONSTRUCTOR: + this.content = new PushMessageContentInvoice(input); + break; + case PushMessageContentLocation.CONSTRUCTOR: + this.content = new PushMessageContentLocation(input); + break; + case PushMessageContentPhoto.CONSTRUCTOR: + this.content = new PushMessageContentPhoto(input); + break; + case PushMessageContentPoll.CONSTRUCTOR: + this.content = new PushMessageContentPoll(input); + break; + case PushMessageContentScreenshotTaken.CONSTRUCTOR: + this.content = new PushMessageContentScreenshotTaken(input); + break; + case PushMessageContentSticker.CONSTRUCTOR: + this.content = new PushMessageContentSticker(input); + break; + case PushMessageContentText.CONSTRUCTOR: + this.content = new PushMessageContentText(input); + break; + case PushMessageContentVideo.CONSTRUCTOR: + this.content = new PushMessageContentVideo(input); + break; + case PushMessageContentVideoNote.CONSTRUCTOR: + this.content = new PushMessageContentVideoNote(input); + break; + case PushMessageContentVoiceNote.CONSTRUCTOR: + this.content = new PushMessageContentVoiceNote(input); + break; + case PushMessageContentBasicGroupChatCreate.CONSTRUCTOR: + this.content = new PushMessageContentBasicGroupChatCreate(input); + break; + case PushMessageContentChatAddMembers.CONSTRUCTOR: + this.content = new PushMessageContentChatAddMembers(input); + break; + case PushMessageContentChatChangePhoto.CONSTRUCTOR: + this.content = new PushMessageContentChatChangePhoto(input); + break; + case PushMessageContentChatChangeTitle.CONSTRUCTOR: + this.content = new PushMessageContentChatChangeTitle(input); + break; + case PushMessageContentChatDeleteMember.CONSTRUCTOR: + this.content = new PushMessageContentChatDeleteMember(input); + break; + case PushMessageContentChatJoinByLink.CONSTRUCTOR: + this.content = new PushMessageContentChatJoinByLink(input); + break; + case PushMessageContentMessageForwards.CONSTRUCTOR: + this.content = new PushMessageContentMessageForwards(input); + break; + case PushMessageContentMediaAlbum.CONSTRUCTOR: + this.content = new PushMessageContentMediaAlbum(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.messageId); + output.writeInt(this.senderUserId); + if (this.senderName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var senderNameTmp = this.senderName.getBytes(StandardCharsets.UTF_8); + output.writeInt(senderNameTmp.length); + output.write(senderNameTmp); + } + output.writeBoolean(this.isOutgoing); + if (this.content == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.content.serialize(output); + } + } } public static class Ok extends Object { - - public Ok() { - } - public static final int CONSTRUCTOR = -722616727; - @Override + public Ok() {} + + + public Ok(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class OptionValue extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class OptionValueBoolean extends OptionValue { public boolean value; - public OptionValueBoolean() { - } + public static final int CONSTRUCTOR = 63135518; + + public OptionValueBoolean() {} public OptionValueBoolean(boolean value) { this.value = value; } - public static final int CONSTRUCTOR = 63135518; + public OptionValueBoolean(DataInputStream input) throws IOException { + this.value = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.value); + } } public static class OptionValueEmpty extends OptionValue { - - public OptionValueEmpty() { - } - public static final int CONSTRUCTOR = 918955155; - @Override + public OptionValueEmpty() {} + + + public OptionValueEmpty(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class OptionValueInteger extends OptionValue { public int value; - public OptionValueInteger() { - } + public static final int CONSTRUCTOR = -1400911104; + + public OptionValueInteger() {} public OptionValueInteger(int value) { this.value = value; } - public static final int CONSTRUCTOR = -1400911104; + public OptionValueInteger(DataInputStream input) throws IOException { + this.value = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value); + } } public static class OptionValueString extends OptionValue { public String value; - public OptionValueString() { - } + public static final int CONSTRUCTOR = 756248212; + + public OptionValueString() {} public OptionValueString(String value) { this.value = value; } - public static final int CONSTRUCTOR = 756248212; + public OptionValueString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var valueTmp = new byte[input.readInt()]; + input.readFully(valueTmp); + this.value = new String(valueTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var valueTmp = this.value.getBytes(StandardCharsets.UTF_8); + output.writeInt(valueTmp.length); + output.write(valueTmp); + } + } } public static class OrderInfo extends Object { @@ -8261,8 +21878,9 @@ public class TdApi { public String emailAddress; public Address shippingAddress; - public OrderInfo() { - } + public static final int CONSTRUCTOR = 783997294; + + public OrderInfo() {} public OrderInfo(String name, String phoneNumber, String emailAddress, Address shippingAddress) { this.name = name; @@ -8271,270 +21889,1250 @@ public class TdApi { this.shippingAddress = shippingAddress; } - public static final int CONSTRUCTOR = 783997294; + public OrderInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var emailAddressTmp = new byte[input.readInt()]; + input.readFully(emailAddressTmp); + this.emailAddress = new String(emailAddressTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Address.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.shippingAddress = new Address(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PageBlock extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.emailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emailAddressTmp = this.emailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(emailAddressTmp.length); + output.write(emailAddressTmp); + } + if (this.shippingAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.shippingAddress.serialize(output); + } + } } public static class PageBlockTitle extends PageBlock { public RichText title; - public PageBlockTitle() { - } + public static final int CONSTRUCTOR = 1629664784; + + public PageBlockTitle() {} public PageBlockTitle(RichText title) { this.title = title; } - public static final int CONSTRUCTOR = 1629664784; + public PageBlockTitle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.title = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.title = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.title = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.title = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.title = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.title = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.title = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.title = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.title = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.title = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.title = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.title = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.title = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.title = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.title = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.title = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.title = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.title.serialize(output); + } + } } public static class PageBlockSubtitle extends PageBlock { public RichText subtitle; - public PageBlockSubtitle() { - } + public static final int CONSTRUCTOR = 264524263; + + public PageBlockSubtitle() {} public PageBlockSubtitle(RichText subtitle) { this.subtitle = subtitle; } - public static final int CONSTRUCTOR = 264524263; + public PageBlockSubtitle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.subtitle = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.subtitle = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.subtitle = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.subtitle = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.subtitle = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.subtitle = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.subtitle = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.subtitle = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.subtitle = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.subtitle = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.subtitle = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.subtitle = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.subtitle = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.subtitle = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.subtitle = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.subtitle = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.subtitle = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.subtitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.subtitle.serialize(output); + } + } } public static class PageBlockAuthorDate extends PageBlock { public RichText author; public int publishDate; - public PageBlockAuthorDate() { - } + public static final int CONSTRUCTOR = 1300231184; + + public PageBlockAuthorDate() {} public PageBlockAuthorDate(RichText author, int publishDate) { this.author = author; this.publishDate = publishDate; } - public static final int CONSTRUCTOR = 1300231184; + public PageBlockAuthorDate(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.author = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.author = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.author = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.author = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.author = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.author = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.author = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.author = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.author = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.author = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.author = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.author = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.author = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.author = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.author = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.author = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.author = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.publishDate = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.author == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.author.serialize(output); + } + output.writeInt(this.publishDate); + } } public static class PageBlockHeader extends PageBlock { public RichText header; - public PageBlockHeader() { - } + public static final int CONSTRUCTOR = 1402854811; + + public PageBlockHeader() {} public PageBlockHeader(RichText header) { this.header = header; } - public static final int CONSTRUCTOR = 1402854811; + public PageBlockHeader(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.header = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.header = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.header = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.header = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.header = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.header = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.header = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.header = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.header = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.header = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.header = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.header = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.header = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.header = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.header = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.header = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.header = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.header == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.header.serialize(output); + } + } } public static class PageBlockSubheader extends PageBlock { public RichText subheader; - public PageBlockSubheader() { - } + public static final int CONSTRUCTOR = 1263956774; + + public PageBlockSubheader() {} public PageBlockSubheader(RichText subheader) { this.subheader = subheader; } - public static final int CONSTRUCTOR = 1263956774; + public PageBlockSubheader(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.subheader = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.subheader = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.subheader = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.subheader = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.subheader = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.subheader = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.subheader = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.subheader = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.subheader = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.subheader = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.subheader = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.subheader = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.subheader = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.subheader = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.subheader = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.subheader = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.subheader = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.subheader == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.subheader.serialize(output); + } + } } public static class PageBlockKicker extends PageBlock { public RichText kicker; - public PageBlockKicker() { - } + public static final int CONSTRUCTOR = 1361282635; + + public PageBlockKicker() {} public PageBlockKicker(RichText kicker) { this.kicker = kicker; } - public static final int CONSTRUCTOR = 1361282635; + public PageBlockKicker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.kicker = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.kicker = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.kicker = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.kicker = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.kicker = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.kicker = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.kicker = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.kicker = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.kicker = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.kicker = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.kicker = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.kicker = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.kicker = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.kicker = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.kicker = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.kicker = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.kicker = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.kicker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.kicker.serialize(output); + } + } } public static class PageBlockParagraph extends PageBlock { public RichText text; - public PageBlockParagraph() { - } + public static final int CONSTRUCTOR = 1182402406; + + public PageBlockParagraph() {} public PageBlockParagraph(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = 1182402406; + public PageBlockParagraph(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class PageBlockPreformatted extends PageBlock { public RichText text; public String language; - public PageBlockPreformatted() { - } + public static final int CONSTRUCTOR = -1066346178; + + public PageBlockPreformatted() {} public PageBlockPreformatted(RichText text, String language) { this.text = text; this.language = language; } - public static final int CONSTRUCTOR = -1066346178; + public PageBlockPreformatted(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var languageTmp = new byte[input.readInt()]; + input.readFully(languageTmp); + this.language = new String(languageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.language == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languageTmp = this.language.getBytes(StandardCharsets.UTF_8); + output.writeInt(languageTmp.length); + output.write(languageTmp); + } + } } public static class PageBlockFooter extends PageBlock { public RichText footer; - public PageBlockFooter() { - } + public static final int CONSTRUCTOR = 886429480; + + public PageBlockFooter() {} public PageBlockFooter(RichText footer) { this.footer = footer; } - public static final int CONSTRUCTOR = 886429480; + public PageBlockFooter(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.footer = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.footer = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.footer = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.footer = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.footer = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.footer = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.footer = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.footer = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.footer = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.footer = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.footer = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.footer = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.footer = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.footer = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.footer = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.footer = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.footer = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.footer == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.footer.serialize(output); + } + } } public static class PageBlockDivider extends PageBlock { - - public PageBlockDivider() { - } - public static final int CONSTRUCTOR = -618614392; - @Override + public PageBlockDivider() {} + + + public PageBlockDivider(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PageBlockAnchor extends PageBlock { public String name; - public PageBlockAnchor() { - } + public static final int CONSTRUCTOR = -837994576; + + public PageBlockAnchor() {} public PageBlockAnchor(String name) { this.name = name; } - public static final int CONSTRUCTOR = -837994576; + public PageBlockAnchor(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + } } public static class PageBlockList extends PageBlock { public PageBlockListItem[] items; - public PageBlockList() { - } + public static final int CONSTRUCTOR = -1037074852; + + public PageBlockList() {} public PageBlockList(PageBlockListItem[] items) { this.items = items; } - public static final int CONSTRUCTOR = -1037074852; + public PageBlockList(DataInputStream input) throws IOException { + this.items = new PageBlockListItem[input.readInt()]; + for (int i = 0; i < this.items.length; i++) { + if (PageBlockListItem.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.items[i] = new PageBlockListItem(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.items.length); + for (int i = 0; i < this.items.length; i++) { + this.items[i].serialize(output); + } + } } public static class PageBlockBlockQuote extends PageBlock { public RichText text; public RichText credit; - public PageBlockBlockQuote() { - } + public static final int CONSTRUCTOR = 1657834142; + + public PageBlockBlockQuote() {} public PageBlockBlockQuote(RichText text, RichText credit) { this.text = text; this.credit = credit; } - public static final int CONSTRUCTOR = 1657834142; + public PageBlockBlockQuote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.credit = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.credit = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.credit = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.credit = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.credit = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.credit = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.credit = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.credit = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.credit = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.credit = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.credit = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.credit = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.credit = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.credit = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.credit = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.credit = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.credit = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.credit == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.credit.serialize(output); + } + } } public static class PageBlockPullQuote extends PageBlock { public RichText text; public RichText credit; - public PageBlockPullQuote() { - } + public static final int CONSTRUCTOR = 490242317; + + public PageBlockPullQuote() {} public PageBlockPullQuote(RichText text, RichText credit) { this.text = text; this.credit = credit; } - public static final int CONSTRUCTOR = 490242317; + public PageBlockPullQuote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.credit = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.credit = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.credit = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.credit = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.credit = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.credit = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.credit = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.credit = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.credit = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.credit = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.credit = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.credit = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.credit = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.credit = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.credit = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.credit = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.credit = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.credit == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.credit.serialize(output); + } + } } public static class PageBlockAnimation extends PageBlock { @@ -8542,8 +23140,9 @@ public class TdApi { public PageBlockCaption caption; public boolean needAutoplay; - public PageBlockAnimation() { - } + public static final int CONSTRUCTOR = 1355669513; + + public PageBlockAnimation() {} public PageBlockAnimation(Animation animation, PageBlockCaption caption, boolean needAutoplay) { this.animation = animation; @@ -8551,32 +23150,91 @@ public class TdApi { this.needAutoplay = needAutoplay; } - public static final int CONSTRUCTOR = 1355669513; + public PageBlockAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new Animation(input); + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + this.needAutoplay = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.needAutoplay); + } } public static class PageBlockAudio extends PageBlock { public Audio audio; public PageBlockCaption caption; - public PageBlockAudio() { - } + public static final int CONSTRUCTOR = -63371245; + + public PageBlockAudio() {} public PageBlockAudio(Audio audio, PageBlockCaption caption) { this.audio = audio; this.caption = caption; } - public static final int CONSTRUCTOR = -63371245; + public PageBlockAudio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Audio.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.audio = new Audio(input); + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class PageBlockPhoto extends PageBlock { @@ -8584,8 +23242,9 @@ public class TdApi { public PageBlockCaption caption; public String url; - public PageBlockPhoto() { - } + public static final int CONSTRUCTOR = 417601156; + + public PageBlockPhoto() {} public PageBlockPhoto(Photo photo, PageBlockCaption caption, String url) { this.photo = photo; @@ -8593,12 +23252,53 @@ public class TdApi { this.url = url; } - public static final int CONSTRUCTOR = 417601156; + public PageBlockPhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class PageBlockVideo extends PageBlock { @@ -8607,8 +23307,9 @@ public class TdApi { public boolean needAutoplay; public boolean isLooped; - public PageBlockVideo() { - } + public static final int CONSTRUCTOR = 510041394; + + public PageBlockVideo() {} public PageBlockVideo(Video video, PageBlockCaption caption, boolean needAutoplay, boolean isLooped) { this.video = video; @@ -8617,50 +23318,215 @@ public class TdApi { this.isLooped = isLooped; } - public static final int CONSTRUCTOR = 510041394; + public PageBlockVideo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Video.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new Video(input); + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + this.needAutoplay = input.readBoolean(); + this.isLooped = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.needAutoplay); + output.writeBoolean(this.isLooped); + } } public static class PageBlockVoiceNote extends PageBlock { public VoiceNote voiceNote; public PageBlockCaption caption; - public PageBlockVoiceNote() { - } + public static final int CONSTRUCTOR = 1823310463; + + public PageBlockVoiceNote() {} public PageBlockVoiceNote(VoiceNote voiceNote, PageBlockCaption caption) { this.voiceNote = voiceNote; this.caption = caption; } - public static final int CONSTRUCTOR = 1823310463; + public PageBlockVoiceNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (VoiceNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.voiceNote = new VoiceNote(input); + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.voiceNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voiceNote.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class PageBlockCover extends PageBlock { public PageBlock cover; - public PageBlockCover() { - } + public static final int CONSTRUCTOR = 972174080; + + public PageBlockCover() {} public PageBlockCover(PageBlock cover) { this.cover = cover; } - public static final int CONSTRUCTOR = 972174080; + public PageBlockCover(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.cover = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.cover = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.cover = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.cover = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.cover = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.cover = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.cover = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.cover = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.cover = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.cover = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.cover = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.cover = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.cover = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.cover = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.cover = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.cover = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.cover = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.cover = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.cover = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.cover = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.cover = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.cover = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.cover = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.cover = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.cover = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.cover = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.cover = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.cover = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.cover = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.cover == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.cover.serialize(output); + } + } } public static class PageBlockEmbedded extends PageBlock { @@ -8673,8 +23539,9 @@ public class TdApi { public boolean isFullWidth; public boolean allowScrolling; - public PageBlockEmbedded() { - } + public static final int CONSTRUCTOR = -1942577763; + + public PageBlockEmbedded() {} public PageBlockEmbedded(String url, String html, Photo posterPhoto, int width, int height, PageBlockCaption caption, boolean isFullWidth, boolean allowScrolling) { this.url = url; @@ -8687,12 +23554,74 @@ public class TdApi { this.allowScrolling = allowScrolling; } - public static final int CONSTRUCTOR = -1942577763; + public PageBlockEmbedded(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var htmlTmp = new byte[input.readInt()]; + input.readFully(htmlTmp); + this.html = new String(htmlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.posterPhoto = new Photo(input); + } + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + this.isFullWidth = input.readBoolean(); + this.allowScrolling = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.html == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var htmlTmp = this.html.getBytes(StandardCharsets.UTF_8); + output.writeInt(htmlTmp.length); + output.write(htmlTmp); + } + if (this.posterPhoto == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.posterPhoto.serialize(output); + } + output.writeInt(this.width); + output.writeInt(this.height); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeBoolean(this.isFullWidth); + output.writeBoolean(this.allowScrolling); + } } public static class PageBlockEmbeddedPost extends PageBlock { @@ -8703,8 +23632,9 @@ public class TdApi { public PageBlock[] pageBlocks; public PageBlockCaption caption; - public PageBlockEmbeddedPost() { - } + public static final int CONSTRUCTOR = 397600949; + + public PageBlockEmbeddedPost() {} public PageBlockEmbeddedPost(String url, String author, Photo authorPhoto, int date, PageBlock[] pageBlocks, PageBlockCaption caption) { this.url = url; @@ -8715,52 +23645,436 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = 397600949; + public PageBlockEmbeddedPost(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var authorTmp = new byte[input.readInt()]; + input.readFully(authorTmp); + this.author = new String(authorTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.authorPhoto = new Photo(input); + } + this.date = input.readInt(); + this.pageBlocks = new PageBlock[input.readInt()]; + for (int i = 0; i < this.pageBlocks.length; i++) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.author == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var authorTmp = this.author.getBytes(StandardCharsets.UTF_8); + output.writeInt(authorTmp.length); + output.write(authorTmp); + } + if (this.authorPhoto == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.authorPhoto.serialize(output); + } + output.writeInt(this.date); + output.writeInt(this.pageBlocks.length); + for (int i = 0; i < this.pageBlocks.length; i++) { + this.pageBlocks[i].serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class PageBlockCollage extends PageBlock { public PageBlock[] pageBlocks; public PageBlockCaption caption; - public PageBlockCollage() { - } + public static final int CONSTRUCTOR = 1163760110; + + public PageBlockCollage() {} public PageBlockCollage(PageBlock[] pageBlocks, PageBlockCaption caption) { this.pageBlocks = pageBlocks; this.caption = caption; } - public static final int CONSTRUCTOR = 1163760110; + public PageBlockCollage(DataInputStream input) throws IOException { + this.pageBlocks = new PageBlock[input.readInt()]; + for (int i = 0; i < this.pageBlocks.length; i++) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.pageBlocks.length); + for (int i = 0; i < this.pageBlocks.length; i++) { + this.pageBlocks[i].serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class PageBlockSlideshow extends PageBlock { public PageBlock[] pageBlocks; public PageBlockCaption caption; - public PageBlockSlideshow() { - } + public static final int CONSTRUCTOR = 539217375; + + public PageBlockSlideshow() {} public PageBlockSlideshow(PageBlock[] pageBlocks, PageBlockCaption caption) { this.pageBlocks = pageBlocks; this.caption = caption; } - public static final int CONSTRUCTOR = 539217375; + public PageBlockSlideshow(DataInputStream input) throws IOException { + this.pageBlocks = new PageBlock[input.readInt()]; + for (int i = 0; i < this.pageBlocks.length; i++) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.pageBlocks.length); + for (int i = 0; i < this.pageBlocks.length; i++) { + this.pageBlocks[i].serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class PageBlockChatLink extends PageBlock { @@ -8768,8 +24082,9 @@ public class TdApi { public ChatPhoto photo; public String username; - public PageBlockChatLink() { - } + public static final int CONSTRUCTOR = 214606645; + + public PageBlockChatLink() {} public PageBlockChatLink(String title, ChatPhoto photo, String username) { this.title = title; @@ -8777,12 +24092,54 @@ public class TdApi { this.username = username; } - public static final int CONSTRUCTOR = 214606645; + public PageBlockChatLink(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (ChatPhoto.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new ChatPhoto(input); + } + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + } } public static class PageBlockTable extends PageBlock { @@ -8791,8 +24148,9 @@ public class TdApi { public boolean isBordered; public boolean isStriped; - public PageBlockTable() { - } + public static final int CONSTRUCTOR = -942649288; + + public PageBlockTable() {} public PageBlockTable(RichText caption, PageBlockTableCell[][] cells, boolean isBordered, boolean isStriped) { this.caption = caption; @@ -8801,12 +24159,100 @@ public class TdApi { this.isStriped = isStriped; } - public static final int CONSTRUCTOR = -942649288; + public PageBlockTable(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.caption = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.caption = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.caption = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.caption = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.caption = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.caption = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.caption = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.caption = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.caption = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.caption = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.caption = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.caption = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.caption = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.caption = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.caption = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.caption = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.caption = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.cells = new PageBlockTableCell[input.readInt()][]; + for (int i = 0; i < this.cells.length; i++) { + this.cells[i] = new PageBlockTableCell[input.readInt()]; + for (int j = 0; j < this.cells[i].length; j++) { + if (PageBlockTableCell.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.cells[i][j] = new PageBlockTableCell(input); + } + } + this.isBordered = input.readBoolean(); + this.isStriped = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + output.writeInt(this.cells.length); + for (int i = 0; i < this.cells.length; i++) { + output.writeInt(this.cells[i].length); + for (int j = 0; j < this.cells[i].length; j++) { + this.cells[i][j].serialize(output); + } + } + output.writeBoolean(this.isBordered); + output.writeBoolean(this.isStriped); + } } public static class PageBlockDetails extends PageBlock { @@ -8814,8 +24260,9 @@ public class TdApi { public PageBlock[] pageBlocks; public boolean isOpen; - public PageBlockDetails() { - } + public static final int CONSTRUCTOR = -1599869809; + + public PageBlockDetails() {} public PageBlockDetails(RichText header, PageBlock[] pageBlocks, boolean isOpen) { this.header = header; @@ -8823,32 +24270,278 @@ public class TdApi { this.isOpen = isOpen; } - public static final int CONSTRUCTOR = -1599869809; + public PageBlockDetails(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.header = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.header = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.header = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.header = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.header = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.header = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.header = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.header = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.header = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.header = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.header = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.header = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.header = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.header = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.header = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.header = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.header = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.pageBlocks = new PageBlock[input.readInt()]; + for (int i = 0; i < this.pageBlocks.length; i++) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.isOpen = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.header == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.header.serialize(output); + } + output.writeInt(this.pageBlocks.length); + for (int i = 0; i < this.pageBlocks.length; i++) { + this.pageBlocks[i].serialize(output); + } + output.writeBoolean(this.isOpen); + } } public static class PageBlockRelatedArticles extends PageBlock { public RichText header; public PageBlockRelatedArticle[] articles; - public PageBlockRelatedArticles() { - } + public static final int CONSTRUCTOR = -1807324374; + + public PageBlockRelatedArticles() {} public PageBlockRelatedArticles(RichText header, PageBlockRelatedArticle[] articles) { this.header = header; this.articles = articles; } - public static final int CONSTRUCTOR = -1807324374; + public PageBlockRelatedArticles(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.header = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.header = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.header = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.header = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.header = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.header = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.header = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.header = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.header = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.header = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.header = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.header = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.header = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.header = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.header = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.header = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.header = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.articles = new PageBlockRelatedArticle[input.readInt()]; + for (int i = 0; i < this.articles.length; i++) { + if (PageBlockRelatedArticle.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.articles[i] = new PageBlockRelatedArticle(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.header == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.header.serialize(output); + } + output.writeInt(this.articles.length); + for (int i = 0; i < this.articles.length; i++) { + this.articles[i].serialize(output); + } + } } public static class PageBlockMap extends PageBlock { @@ -8858,8 +24551,9 @@ public class TdApi { public int height; public PageBlockCaption caption; - public PageBlockMap() { - } + public static final int CONSTRUCTOR = 1510961171; + + public PageBlockMap() {} public PageBlockMap(Location location, int zoom, int width, int height, PageBlockCaption caption) { this.location = location; @@ -8869,94 +24563,387 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = 1510961171; + public PageBlockMap(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + this.zoom = input.readInt(); + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + if (PageBlockCaption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new PageBlockCaption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + output.writeInt(this.zoom); + output.writeInt(this.width); + output.writeInt(this.height); + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class PageBlockCaption extends Object { public RichText text; public RichText credit; - public PageBlockCaption() { - } + public static final int CONSTRUCTOR = -1180064650; + + public PageBlockCaption() {} public PageBlockCaption(RichText text, RichText credit) { this.text = text; this.credit = credit; } - public static final int CONSTRUCTOR = -1180064650; + public PageBlockCaption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.credit = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.credit = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.credit = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.credit = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.credit = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.credit = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.credit = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.credit = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.credit = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.credit = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.credit = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.credit = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.credit = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.credit = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.credit = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.credit = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.credit = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PageBlockHorizontalAlignment extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.credit == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.credit.serialize(output); + } + } } public static class PageBlockHorizontalAlignmentLeft extends PageBlockHorizontalAlignment { - - public PageBlockHorizontalAlignmentLeft() { - } - public static final int CONSTRUCTOR = 848701417; - @Override + public PageBlockHorizontalAlignmentLeft() {} + + + public PageBlockHorizontalAlignmentLeft(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PageBlockHorizontalAlignmentCenter extends PageBlockHorizontalAlignment { - - public PageBlockHorizontalAlignmentCenter() { - } - public static final int CONSTRUCTOR = -1009203990; - @Override + public PageBlockHorizontalAlignmentCenter() {} + + + public PageBlockHorizontalAlignmentCenter(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PageBlockHorizontalAlignmentRight extends PageBlockHorizontalAlignment { - - public PageBlockHorizontalAlignmentRight() { - } - public static final int CONSTRUCTOR = 1371369214; - @Override + public PageBlockHorizontalAlignmentRight() {} + + + public PageBlockHorizontalAlignmentRight(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PageBlockListItem extends Object { public String label; public PageBlock[] pageBlocks; - public PageBlockListItem() { - } + public static final int CONSTRUCTOR = 323186259; + + public PageBlockListItem() {} public PageBlockListItem(String label, PageBlock[] pageBlocks) { this.label = label; this.pageBlocks = pageBlocks; } - public static final int CONSTRUCTOR = 323186259; + public PageBlockListItem(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var labelTmp = new byte[input.readInt()]; + input.readFully(labelTmp); + this.label = new String(labelTmp, StandardCharsets.UTF_8); + } + this.pageBlocks = new PageBlock[input.readInt()]; + for (int i = 0; i < this.pageBlocks.length; i++) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.label == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var labelTmp = this.label.getBytes(StandardCharsets.UTF_8); + output.writeInt(labelTmp.length); + output.write(labelTmp); + } + output.writeInt(this.pageBlocks.length); + for (int i = 0; i < this.pageBlocks.length; i++) { + this.pageBlocks[i].serialize(output); + } + } } public static class PageBlockRelatedArticle extends Object { @@ -8967,8 +24954,9 @@ public class TdApi { public String author; public int publishDate; - public PageBlockRelatedArticle() { - } + public static final int CONSTRUCTOR = 481199251; + + public PageBlockRelatedArticle() {} public PageBlockRelatedArticle(String url, String title, String description, Photo photo, String author, int publishDate) { this.url = url; @@ -8979,12 +24967,82 @@ public class TdApi { this.publishDate = publishDate; } - public static final int CONSTRUCTOR = 481199251; + public PageBlockRelatedArticle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + var authorTmp = new byte[input.readInt()]; + input.readFully(authorTmp); + this.author = new String(authorTmp, StandardCharsets.UTF_8); + } + this.publishDate = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.author == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var authorTmp = this.author.getBytes(StandardCharsets.UTF_8); + output.writeInt(authorTmp.length); + output.write(authorTmp); + } + output.writeInt(this.publishDate); + } } public static class PageBlockTableCell extends Object { @@ -8995,8 +25053,9 @@ public class TdApi { public PageBlockHorizontalAlignment align; public PageBlockVerticalAlignment valign; - public PageBlockTableCell() { - } + public static final int CONSTRUCTOR = 1417658214; + + public PageBlockTableCell() {} public PageBlockTableCell(RichText text, boolean isHeader, int colspan, int rowspan, PageBlockHorizontalAlignment align, PageBlockVerticalAlignment valign) { this.text = text; @@ -9007,54 +25066,181 @@ public class TdApi { this.valign = valign; } - public static final int CONSTRUCTOR = 1417658214; + public PageBlockTableCell(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.isHeader = input.readBoolean(); + this.colspan = input.readInt(); + this.rowspan = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case PageBlockHorizontalAlignmentLeft.CONSTRUCTOR: + this.align = new PageBlockHorizontalAlignmentLeft(input); + break; + case PageBlockHorizontalAlignmentCenter.CONSTRUCTOR: + this.align = new PageBlockHorizontalAlignmentCenter(input); + break; + case PageBlockHorizontalAlignmentRight.CONSTRUCTOR: + this.align = new PageBlockHorizontalAlignmentRight(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case PageBlockVerticalAlignmentTop.CONSTRUCTOR: + this.valign = new PageBlockVerticalAlignmentTop(input); + break; + case PageBlockVerticalAlignmentMiddle.CONSTRUCTOR: + this.valign = new PageBlockVerticalAlignmentMiddle(input); + break; + case PageBlockVerticalAlignmentBottom.CONSTRUCTOR: + this.valign = new PageBlockVerticalAlignmentBottom(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PageBlockVerticalAlignment extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + output.writeBoolean(this.isHeader); + output.writeInt(this.colspan); + output.writeInt(this.rowspan); + if (this.align == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.align.serialize(output); + } + if (this.valign == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.valign.serialize(output); + } + } } public static class PageBlockVerticalAlignmentTop extends PageBlockVerticalAlignment { - - public PageBlockVerticalAlignmentTop() { - } - public static final int CONSTRUCTOR = 195500454; - @Override + public PageBlockVerticalAlignmentTop() {} + + + public PageBlockVerticalAlignmentTop(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PageBlockVerticalAlignmentMiddle extends PageBlockVerticalAlignment { - - public PageBlockVerticalAlignmentMiddle() { - } - public static final int CONSTRUCTOR = -2123096587; - @Override + public PageBlockVerticalAlignmentMiddle() {} + + + public PageBlockVerticalAlignmentMiddle(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PageBlockVerticalAlignmentBottom extends PageBlockVerticalAlignment { - - public PageBlockVerticalAlignmentBottom() { - } - public static final int CONSTRUCTOR = 2092531158; - @Override + public PageBlockVerticalAlignmentBottom() {} + + + public PageBlockVerticalAlignmentBottom(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportAuthorizationForm extends Object { @@ -9062,8 +25248,9 @@ public class TdApi { public PassportRequiredElement[] requiredElements; public String privacyPolicyUrl; - public PassportAuthorizationForm() { - } + public static final int CONSTRUCTOR = -1070673218; + + public PassportAuthorizationForm() {} public PassportAuthorizationForm(int id, PassportRequiredElement[] requiredElements, String privacyPolicyUrl) { this.id = id; @@ -9071,249 +25258,499 @@ public class TdApi { this.privacyPolicyUrl = privacyPolicyUrl; } - public static final int CONSTRUCTOR = -1070673218; + public PassportAuthorizationForm(DataInputStream input) throws IOException { + this.id = input.readInt(); + this.requiredElements = new PassportRequiredElement[input.readInt()]; + for (int i = 0; i < this.requiredElements.length; i++) { + if (PassportRequiredElement.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.requiredElements[i] = new PassportRequiredElement(input); + } + if (input.readBoolean()) { + var privacyPolicyUrlTmp = new byte[input.readInt()]; + input.readFully(privacyPolicyUrlTmp); + this.privacyPolicyUrl = new String(privacyPolicyUrlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PassportElement extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + output.writeInt(this.requiredElements.length); + for (int i = 0; i < this.requiredElements.length; i++) { + this.requiredElements[i].serialize(output); + } + if (this.privacyPolicyUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var privacyPolicyUrlTmp = this.privacyPolicyUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(privacyPolicyUrlTmp.length); + output.write(privacyPolicyUrlTmp); + } + } } public static class PassportElementPersonalDetails extends PassportElement { public PersonalDetails personalDetails; - public PassportElementPersonalDetails() { - } + public static final int CONSTRUCTOR = 1217724035; + + public PassportElementPersonalDetails() {} public PassportElementPersonalDetails(PersonalDetails personalDetails) { this.personalDetails = personalDetails; } - public static final int CONSTRUCTOR = 1217724035; + public PassportElementPersonalDetails(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDetails.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.personalDetails = new PersonalDetails(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.personalDetails == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.personalDetails.serialize(output); + } + } } public static class PassportElementPassport extends PassportElement { public IdentityDocument passport; - public PassportElementPassport() { - } + public static final int CONSTRUCTOR = -263985373; + + public PassportElementPassport() {} public PassportElementPassport(IdentityDocument passport) { this.passport = passport; } - public static final int CONSTRUCTOR = -263985373; + public PassportElementPassport(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (IdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.passport = new IdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.passport == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.passport.serialize(output); + } + } } public static class PassportElementDriverLicense extends PassportElement { public IdentityDocument driverLicense; - public PassportElementDriverLicense() { - } + public static final int CONSTRUCTOR = 1643580589; + + public PassportElementDriverLicense() {} public PassportElementDriverLicense(IdentityDocument driverLicense) { this.driverLicense = driverLicense; } - public static final int CONSTRUCTOR = 1643580589; + public PassportElementDriverLicense(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (IdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.driverLicense = new IdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.driverLicense == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.driverLicense.serialize(output); + } + } } public static class PassportElementIdentityCard extends PassportElement { public IdentityDocument identityCard; - public PassportElementIdentityCard() { - } + public static final int CONSTRUCTOR = 2083775797; + + public PassportElementIdentityCard() {} public PassportElementIdentityCard(IdentityDocument identityCard) { this.identityCard = identityCard; } - public static final int CONSTRUCTOR = 2083775797; + public PassportElementIdentityCard(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (IdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.identityCard = new IdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.identityCard == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.identityCard.serialize(output); + } + } } public static class PassportElementInternalPassport extends PassportElement { public IdentityDocument internalPassport; - public PassportElementInternalPassport() { - } + public static final int CONSTRUCTOR = 36220295; + + public PassportElementInternalPassport() {} public PassportElementInternalPassport(IdentityDocument internalPassport) { this.internalPassport = internalPassport; } - public static final int CONSTRUCTOR = 36220295; + public PassportElementInternalPassport(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (IdentityDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.internalPassport = new IdentityDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.internalPassport == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.internalPassport.serialize(output); + } + } } public static class PassportElementAddress extends PassportElement { public Address address; - public PassportElementAddress() { - } + public static final int CONSTRUCTOR = -782625232; + + public PassportElementAddress() {} public PassportElementAddress(Address address) { this.address = address; } - public static final int CONSTRUCTOR = -782625232; + public PassportElementAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Address.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.address = new Address(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.address == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.address.serialize(output); + } + } } public static class PassportElementUtilityBill extends PassportElement { public PersonalDocument utilityBill; - public PassportElementUtilityBill() { - } + public static final int CONSTRUCTOR = -234611246; + + public PassportElementUtilityBill() {} public PassportElementUtilityBill(PersonalDocument utilityBill) { this.utilityBill = utilityBill; } - public static final int CONSTRUCTOR = -234611246; + public PassportElementUtilityBill(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.utilityBill = new PersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.utilityBill == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.utilityBill.serialize(output); + } + } } public static class PassportElementBankStatement extends PassportElement { public PersonalDocument bankStatement; - public PassportElementBankStatement() { - } + public static final int CONSTRUCTOR = -366464408; + + public PassportElementBankStatement() {} public PassportElementBankStatement(PersonalDocument bankStatement) { this.bankStatement = bankStatement; } - public static final int CONSTRUCTOR = -366464408; + public PassportElementBankStatement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.bankStatement = new PersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.bankStatement == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.bankStatement.serialize(output); + } + } } public static class PassportElementRentalAgreement extends PassportElement { public PersonalDocument rentalAgreement; - public PassportElementRentalAgreement() { - } + public static final int CONSTRUCTOR = -290141400; + + public PassportElementRentalAgreement() {} public PassportElementRentalAgreement(PersonalDocument rentalAgreement) { this.rentalAgreement = rentalAgreement; } - public static final int CONSTRUCTOR = -290141400; + public PassportElementRentalAgreement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.rentalAgreement = new PersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.rentalAgreement == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.rentalAgreement.serialize(output); + } + } } public static class PassportElementPassportRegistration extends PassportElement { public PersonalDocument passportRegistration; - public PassportElementPassportRegistration() { - } + public static final int CONSTRUCTOR = 618323071; + + public PassportElementPassportRegistration() {} public PassportElementPassportRegistration(PersonalDocument passportRegistration) { this.passportRegistration = passportRegistration; } - public static final int CONSTRUCTOR = 618323071; + public PassportElementPassportRegistration(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.passportRegistration = new PersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.passportRegistration == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.passportRegistration.serialize(output); + } + } } public static class PassportElementTemporaryRegistration extends PassportElement { public PersonalDocument temporaryRegistration; - public PassportElementTemporaryRegistration() { - } + public static final int CONSTRUCTOR = 1237626864; + + public PassportElementTemporaryRegistration() {} public PassportElementTemporaryRegistration(PersonalDocument temporaryRegistration) { this.temporaryRegistration = temporaryRegistration; } - public static final int CONSTRUCTOR = 1237626864; + public PassportElementTemporaryRegistration(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (PersonalDocument.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.temporaryRegistration = new PersonalDocument(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.temporaryRegistration == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.temporaryRegistration.serialize(output); + } + } } public static class PassportElementPhoneNumber extends PassportElement { public String phoneNumber; - public PassportElementPhoneNumber() { - } + public static final int CONSTRUCTOR = -1320118375; + + public PassportElementPhoneNumber() {} public PassportElementPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } - public static final int CONSTRUCTOR = -1320118375; + public PassportElementPhoneNumber(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + } } public static class PassportElementEmailAddress extends PassportElement { public String emailAddress; - public PassportElementEmailAddress() { - } + public static final int CONSTRUCTOR = -1528129531; + + public PassportElementEmailAddress() {} public PassportElementEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } - public static final int CONSTRUCTOR = -1528129531; + public PassportElementEmailAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emailAddressTmp = new byte[input.readInt()]; + input.readFully(emailAddressTmp); + this.emailAddress = new String(emailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emailAddressTmp = this.emailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(emailAddressTmp.length); + output.write(emailAddressTmp); + } + } } public static class PassportElementError extends Object { @@ -9321,8 +25758,9 @@ public class TdApi { public String message; public PassportElementErrorSource source; - public PassportElementError() { - } + public static final int CONSTRUCTOR = -1861902395; + + public PassportElementError() {} public PassportElementError(PassportElementType type, String message, PassportElementErrorSource source) { this.type = type; @@ -9330,375 +25768,740 @@ public class TdApi { this.source = source; } - public static final int CONSTRUCTOR = -1861902395; + public PassportElementError(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.type = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.type = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.type = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.type = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.type = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.type = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.type = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.type = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.type = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.type = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.type = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.type = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.type = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var messageTmp = new byte[input.readInt()]; + input.readFully(messageTmp); + this.message = new String(messageTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementErrorSourceUnspecified.CONSTRUCTOR: + this.source = new PassportElementErrorSourceUnspecified(input); + break; + case PassportElementErrorSourceDataField.CONSTRUCTOR: + this.source = new PassportElementErrorSourceDataField(input); + break; + case PassportElementErrorSourceFrontSide.CONSTRUCTOR: + this.source = new PassportElementErrorSourceFrontSide(input); + break; + case PassportElementErrorSourceReverseSide.CONSTRUCTOR: + this.source = new PassportElementErrorSourceReverseSide(input); + break; + case PassportElementErrorSourceSelfie.CONSTRUCTOR: + this.source = new PassportElementErrorSourceSelfie(input); + break; + case PassportElementErrorSourceTranslationFile.CONSTRUCTOR: + this.source = new PassportElementErrorSourceTranslationFile(input); + break; + case PassportElementErrorSourceTranslationFiles.CONSTRUCTOR: + this.source = new PassportElementErrorSourceTranslationFiles(input); + break; + case PassportElementErrorSourceFile.CONSTRUCTOR: + this.source = new PassportElementErrorSourceFile(input); + break; + case PassportElementErrorSourceFiles.CONSTRUCTOR: + this.source = new PassportElementErrorSourceFiles(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PassportElementErrorSource extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var messageTmp = this.message.getBytes(StandardCharsets.UTF_8); + output.writeInt(messageTmp.length); + output.write(messageTmp); + } + if (this.source == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.source.serialize(output); + } + } } public static class PassportElementErrorSourceUnspecified extends PassportElementErrorSource { - - public PassportElementErrorSourceUnspecified() { - } - public static final int CONSTRUCTOR = -378320830; - @Override + public PassportElementErrorSourceUnspecified() {} + + + public PassportElementErrorSourceUnspecified(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementErrorSourceDataField extends PassportElementErrorSource { public String fieldName; - public PassportElementErrorSourceDataField() { - } + public static final int CONSTRUCTOR = -308650776; + + public PassportElementErrorSourceDataField() {} public PassportElementErrorSourceDataField(String fieldName) { this.fieldName = fieldName; } - public static final int CONSTRUCTOR = -308650776; + public PassportElementErrorSourceDataField(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var fieldNameTmp = new byte[input.readInt()]; + input.readFully(fieldNameTmp); + this.fieldName = new String(fieldNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fieldName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fieldNameTmp = this.fieldName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fieldNameTmp.length); + output.write(fieldNameTmp); + } + } } public static class PassportElementErrorSourceFrontSide extends PassportElementErrorSource { - - public PassportElementErrorSourceFrontSide() { - } - public static final int CONSTRUCTOR = 1895658292; - @Override + public PassportElementErrorSourceFrontSide() {} + + + public PassportElementErrorSourceFrontSide(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementErrorSourceReverseSide extends PassportElementErrorSource { - - public PassportElementErrorSourceReverseSide() { - } - public static final int CONSTRUCTOR = 1918630391; - @Override + public PassportElementErrorSourceReverseSide() {} + + + public PassportElementErrorSourceReverseSide(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementErrorSourceSelfie extends PassportElementErrorSource { - - public PassportElementErrorSourceSelfie() { - } - public static final int CONSTRUCTOR = -797043672; - @Override + public PassportElementErrorSourceSelfie() {} + + + public PassportElementErrorSourceSelfie(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementErrorSourceTranslationFile extends PassportElementErrorSource { public int fileIndex; - public PassportElementErrorSourceTranslationFile() { - } + public static final int CONSTRUCTOR = -689621228; + + public PassportElementErrorSourceTranslationFile() {} public PassportElementErrorSourceTranslationFile(int fileIndex) { this.fileIndex = fileIndex; } - public static final int CONSTRUCTOR = -689621228; + public PassportElementErrorSourceTranslationFile(DataInputStream input) throws IOException { + this.fileIndex = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileIndex); + } } public static class PassportElementErrorSourceTranslationFiles extends PassportElementErrorSource { - - public PassportElementErrorSourceTranslationFiles() { - } - public static final int CONSTRUCTOR = 581280796; - @Override + public PassportElementErrorSourceTranslationFiles() {} + + + public PassportElementErrorSourceTranslationFiles(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementErrorSourceFile extends PassportElementErrorSource { public int fileIndex; - public PassportElementErrorSourceFile() { - } + public static final int CONSTRUCTOR = 2020358960; + + public PassportElementErrorSourceFile() {} public PassportElementErrorSourceFile(int fileIndex) { this.fileIndex = fileIndex; } - public static final int CONSTRUCTOR = 2020358960; + public PassportElementErrorSourceFile(DataInputStream input) throws IOException { + this.fileIndex = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileIndex); + } } public static class PassportElementErrorSourceFiles extends PassportElementErrorSource { - - public PassportElementErrorSourceFiles() { - } - public static final int CONSTRUCTOR = 1894164178; - @Override + public PassportElementErrorSourceFiles() {} + + + public PassportElementErrorSourceFiles(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PassportElementType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypePersonalDetails extends PassportElementType { - - public PassportElementTypePersonalDetails() { - } - public static final int CONSTRUCTOR = -1032136365; - @Override + public PassportElementTypePersonalDetails() {} + + + public PassportElementTypePersonalDetails(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypePassport extends PassportElementType { - - public PassportElementTypePassport() { - } - public static final int CONSTRUCTOR = -436360376; - @Override + public PassportElementTypePassport() {} + + + public PassportElementTypePassport(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeDriverLicense extends PassportElementType { - - public PassportElementTypeDriverLicense() { - } - public static final int CONSTRUCTOR = 1827298379; - @Override + public PassportElementTypeDriverLicense() {} + + + public PassportElementTypeDriverLicense(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeIdentityCard extends PassportElementType { - - public PassportElementTypeIdentityCard() { - } - public static final int CONSTRUCTOR = -502356132; - @Override + public PassportElementTypeIdentityCard() {} + + + public PassportElementTypeIdentityCard(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeInternalPassport extends PassportElementType { - - public PassportElementTypeInternalPassport() { - } - public static final int CONSTRUCTOR = -793781959; - @Override + public PassportElementTypeInternalPassport() {} + + + public PassportElementTypeInternalPassport(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeAddress extends PassportElementType { - - public PassportElementTypeAddress() { - } - public static final int CONSTRUCTOR = 496327874; - @Override + public PassportElementTypeAddress() {} + + + public PassportElementTypeAddress(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeUtilityBill extends PassportElementType { - - public PassportElementTypeUtilityBill() { - } - public static final int CONSTRUCTOR = 627084906; - @Override + public PassportElementTypeUtilityBill() {} + + + public PassportElementTypeUtilityBill(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeBankStatement extends PassportElementType { - - public PassportElementTypeBankStatement() { - } - public static final int CONSTRUCTOR = 574095667; - @Override + public PassportElementTypeBankStatement() {} + + + public PassportElementTypeBankStatement(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeRentalAgreement extends PassportElementType { - - public PassportElementTypeRentalAgreement() { - } - public static final int CONSTRUCTOR = -2060583280; - @Override + public PassportElementTypeRentalAgreement() {} + + + public PassportElementTypeRentalAgreement(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypePassportRegistration extends PassportElementType { - - public PassportElementTypePassportRegistration() { - } - public static final int CONSTRUCTOR = -159478209; - @Override + public PassportElementTypePassportRegistration() {} + + + public PassportElementTypePassportRegistration(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeTemporaryRegistration extends PassportElementType { - - public PassportElementTypeTemporaryRegistration() { - } - public static final int CONSTRUCTOR = 1092498527; - @Override + public PassportElementTypeTemporaryRegistration() {} + + + public PassportElementTypeTemporaryRegistration(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypePhoneNumber extends PassportElementType { - - public PassportElementTypePhoneNumber() { - } - public static final int CONSTRUCTOR = -995361172; - @Override + public PassportElementTypePhoneNumber() {} + + + public PassportElementTypePhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElementTypeEmailAddress extends PassportElementType { - - public PassportElementTypeEmailAddress() { - } - public static final int CONSTRUCTOR = -79321405; - @Override + public PassportElementTypeEmailAddress() {} + + + public PassportElementTypeEmailAddress(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PassportElements extends Object { public PassportElement[] elements; - public PassportElements() { - } + public static final int CONSTRUCTOR = 1264617556; + + public PassportElements() {} public PassportElements(PassportElement[] elements) { this.elements = elements; } - public static final int CONSTRUCTOR = 1264617556; + public PassportElements(DataInputStream input) throws IOException { + this.elements = new PassportElement[input.readInt()]; + for (int i = 0; i < this.elements.length; i++) { + switch(input.readInt()) { + case PassportElementPersonalDetails.CONSTRUCTOR: + this.elements[i] = new PassportElementPersonalDetails(input); + break; + case PassportElementPassport.CONSTRUCTOR: + this.elements[i] = new PassportElementPassport(input); + break; + case PassportElementDriverLicense.CONSTRUCTOR: + this.elements[i] = new PassportElementDriverLicense(input); + break; + case PassportElementIdentityCard.CONSTRUCTOR: + this.elements[i] = new PassportElementIdentityCard(input); + break; + case PassportElementInternalPassport.CONSTRUCTOR: + this.elements[i] = new PassportElementInternalPassport(input); + break; + case PassportElementAddress.CONSTRUCTOR: + this.elements[i] = new PassportElementAddress(input); + break; + case PassportElementUtilityBill.CONSTRUCTOR: + this.elements[i] = new PassportElementUtilityBill(input); + break; + case PassportElementBankStatement.CONSTRUCTOR: + this.elements[i] = new PassportElementBankStatement(input); + break; + case PassportElementRentalAgreement.CONSTRUCTOR: + this.elements[i] = new PassportElementRentalAgreement(input); + break; + case PassportElementPassportRegistration.CONSTRUCTOR: + this.elements[i] = new PassportElementPassportRegistration(input); + break; + case PassportElementTemporaryRegistration.CONSTRUCTOR: + this.elements[i] = new PassportElementTemporaryRegistration(input); + break; + case PassportElementPhoneNumber.CONSTRUCTOR: + this.elements[i] = new PassportElementPhoneNumber(input); + break; + case PassportElementEmailAddress.CONSTRUCTOR: + this.elements[i] = new PassportElementEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.elements.length); + for (int i = 0; i < this.elements.length; i++) { + this.elements[i].serialize(output); + } + } } public static class PassportElementsWithErrors extends Object { public PassportElement[] elements; public PassportElementError[] errors; - public PassportElementsWithErrors() { - } + public static final int CONSTRUCTOR = 1308923044; + + public PassportElementsWithErrors() {} public PassportElementsWithErrors(PassportElement[] elements, PassportElementError[] errors) { this.elements = elements; this.errors = errors; } - public static final int CONSTRUCTOR = 1308923044; + public PassportElementsWithErrors(DataInputStream input) throws IOException { + this.elements = new PassportElement[input.readInt()]; + for (int i = 0; i < this.elements.length; i++) { + switch(input.readInt()) { + case PassportElementPersonalDetails.CONSTRUCTOR: + this.elements[i] = new PassportElementPersonalDetails(input); + break; + case PassportElementPassport.CONSTRUCTOR: + this.elements[i] = new PassportElementPassport(input); + break; + case PassportElementDriverLicense.CONSTRUCTOR: + this.elements[i] = new PassportElementDriverLicense(input); + break; + case PassportElementIdentityCard.CONSTRUCTOR: + this.elements[i] = new PassportElementIdentityCard(input); + break; + case PassportElementInternalPassport.CONSTRUCTOR: + this.elements[i] = new PassportElementInternalPassport(input); + break; + case PassportElementAddress.CONSTRUCTOR: + this.elements[i] = new PassportElementAddress(input); + break; + case PassportElementUtilityBill.CONSTRUCTOR: + this.elements[i] = new PassportElementUtilityBill(input); + break; + case PassportElementBankStatement.CONSTRUCTOR: + this.elements[i] = new PassportElementBankStatement(input); + break; + case PassportElementRentalAgreement.CONSTRUCTOR: + this.elements[i] = new PassportElementRentalAgreement(input); + break; + case PassportElementPassportRegistration.CONSTRUCTOR: + this.elements[i] = new PassportElementPassportRegistration(input); + break; + case PassportElementTemporaryRegistration.CONSTRUCTOR: + this.elements[i] = new PassportElementTemporaryRegistration(input); + break; + case PassportElementPhoneNumber.CONSTRUCTOR: + this.elements[i] = new PassportElementPhoneNumber(input); + break; + case PassportElementEmailAddress.CONSTRUCTOR: + this.elements[i] = new PassportElementEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.errors = new PassportElementError[input.readInt()]; + for (int i = 0; i < this.errors.length; i++) { + if (PassportElementError.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.errors[i] = new PassportElementError(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.elements.length); + for (int i = 0; i < this.elements.length; i++) { + this.elements[i].serialize(output); + } + output.writeInt(this.errors.length); + for (int i = 0; i < this.errors.length; i++) { + this.errors[i].serialize(output); + } + } } public static class PassportRequiredElement extends Object { public PassportSuitableElement[] suitableElements; - public PassportRequiredElement() { - } + public static final int CONSTRUCTOR = -1983641651; + + public PassportRequiredElement() {} public PassportRequiredElement(PassportSuitableElement[] suitableElements) { this.suitableElements = suitableElements; } - public static final int CONSTRUCTOR = -1983641651; + public PassportRequiredElement(DataInputStream input) throws IOException { + this.suitableElements = new PassportSuitableElement[input.readInt()]; + for (int i = 0; i < this.suitableElements.length; i++) { + if (PassportSuitableElement.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.suitableElements[i] = new PassportSuitableElement(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.suitableElements.length); + for (int i = 0; i < this.suitableElements.length; i++) { + this.suitableElements[i].serialize(output); + } + } } public static class PassportSuitableElement extends Object { @@ -9707,8 +26510,9 @@ public class TdApi { public boolean isTranslationRequired; public boolean isNativeNameRequired; - public PassportSuitableElement() { - } + public static final int CONSTRUCTOR = -789019876; + + public PassportSuitableElement() {} public PassportSuitableElement(PassportElementType type, boolean isSelfieRequired, boolean isTranslationRequired, boolean isNativeNameRequired) { this.type = type; @@ -9717,12 +26521,73 @@ public class TdApi { this.isNativeNameRequired = isNativeNameRequired; } - public static final int CONSTRUCTOR = -789019876; + public PassportSuitableElement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.type = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.type = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.type = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.type = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.type = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.type = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.type = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.type = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.type = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.type = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.type = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.type = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.type = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.isSelfieRequired = input.readBoolean(); + this.isTranslationRequired = input.readBoolean(); + this.isNativeNameRequired = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeBoolean(this.isSelfieRequired); + output.writeBoolean(this.isTranslationRequired); + output.writeBoolean(this.isNativeNameRequired); + } } public static class PasswordState extends Object { @@ -9732,8 +26597,9 @@ public class TdApi { public boolean hasPassportData; public EmailAddressAuthenticationCodeInfo recoveryEmailAddressCodeInfo; - public PasswordState() { - } + public static final int CONSTRUCTOR = -1154797731; + + public PasswordState() {} public PasswordState(boolean hasPassword, String passwordHint, boolean hasRecoveryEmailAddress, boolean hasPassportData, EmailAddressAuthenticationCodeInfo recoveryEmailAddressCodeInfo) { this.hasPassword = hasPassword; @@ -9743,12 +26609,47 @@ public class TdApi { this.recoveryEmailAddressCodeInfo = recoveryEmailAddressCodeInfo; } - public static final int CONSTRUCTOR = -1154797731; + public PasswordState(DataInputStream input) throws IOException { + this.hasPassword = input.readBoolean(); + if (input.readBoolean()) { + var passwordHintTmp = new byte[input.readInt()]; + input.readFully(passwordHintTmp); + this.passwordHint = new String(passwordHintTmp, StandardCharsets.UTF_8); + } + this.hasRecoveryEmailAddress = input.readBoolean(); + this.hasPassportData = input.readBoolean(); + if (input.readBoolean()) { + if (EmailAddressAuthenticationCodeInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.recoveryEmailAddressCodeInfo = new EmailAddressAuthenticationCodeInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.hasPassword); + if (this.passwordHint == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordHintTmp = this.passwordHint.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordHintTmp.length); + output.write(passwordHintTmp); + } + output.writeBoolean(this.hasRecoveryEmailAddress); + output.writeBoolean(this.hasPassportData); + if (this.recoveryEmailAddressCodeInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.recoveryEmailAddressCodeInfo.serialize(output); + } + } } public static class PaymentForm extends Object { @@ -9760,8 +26661,9 @@ public class TdApi { public boolean canSaveCredentials; public boolean needPassword; - public PaymentForm() { - } + public static final int CONSTRUCTOR = -200418230; + + public PaymentForm() {} public PaymentForm(Invoice invoice, String url, PaymentsProviderStripe paymentsProvider, OrderInfo savedOrderInfo, SavedCredentials savedCredentials, boolean canSaveCredentials, boolean needPassword) { this.invoice = invoice; @@ -9773,12 +26675,81 @@ public class TdApi { this.needPassword = needPassword; } - public static final int CONSTRUCTOR = -200418230; + public PaymentForm(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Invoice.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.invoice = new Invoice(input); + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PaymentsProviderStripe.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.paymentsProvider = new PaymentsProviderStripe(input); + } + if (input.readBoolean()) { + if (OrderInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.savedOrderInfo = new OrderInfo(input); + } + if (input.readBoolean()) { + if (SavedCredentials.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.savedCredentials = new SavedCredentials(input); + } + this.canSaveCredentials = input.readBoolean(); + this.needPassword = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.invoice == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.invoice.serialize(output); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.paymentsProvider == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.paymentsProvider.serialize(output); + } + if (this.savedOrderInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.savedOrderInfo.serialize(output); + } + if (this.savedCredentials == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.savedCredentials.serialize(output); + } + output.writeBoolean(this.canSaveCredentials); + output.writeBoolean(this.needPassword); + } } public static class PaymentReceipt extends Object { @@ -9789,8 +26760,9 @@ public class TdApi { public ShippingOption shippingOption; public String credentialsTitle; - public PaymentReceipt() { - } + public static final int CONSTRUCTOR = -1171223545; + + public PaymentReceipt() {} public PaymentReceipt(int date, int paymentsProviderUserId, Invoice invoice, OrderInfo orderInfo, ShippingOption shippingOption, String credentialsTitle) { this.date = date; @@ -9801,32 +26773,109 @@ public class TdApi { this.credentialsTitle = credentialsTitle; } - public static final int CONSTRUCTOR = -1171223545; + public PaymentReceipt(DataInputStream input) throws IOException { + this.date = input.readInt(); + this.paymentsProviderUserId = input.readInt(); + if (input.readBoolean()) { + if (Invoice.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.invoice = new Invoice(input); + } + if (input.readBoolean()) { + if (OrderInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.orderInfo = new OrderInfo(input); + } + if (input.readBoolean()) { + if (ShippingOption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.shippingOption = new ShippingOption(input); + } + if (input.readBoolean()) { + var credentialsTitleTmp = new byte[input.readInt()]; + input.readFully(credentialsTitleTmp); + this.credentialsTitle = new String(credentialsTitleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.date); + output.writeInt(this.paymentsProviderUserId); + if (this.invoice == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.invoice.serialize(output); + } + if (this.orderInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.orderInfo.serialize(output); + } + if (this.shippingOption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.shippingOption.serialize(output); + } + if (this.credentialsTitle == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var credentialsTitleTmp = this.credentialsTitle.getBytes(StandardCharsets.UTF_8); + output.writeInt(credentialsTitleTmp.length); + output.write(credentialsTitleTmp); + } + } } public static class PaymentResult extends Object { public boolean success; public String verificationUrl; - public PaymentResult() { - } + public static final int CONSTRUCTOR = -804263843; + + public PaymentResult() {} public PaymentResult(boolean success, String verificationUrl) { this.success = success; this.verificationUrl = verificationUrl; } - public static final int CONSTRUCTOR = -804263843; + public PaymentResult(DataInputStream input) throws IOException { + this.success = input.readBoolean(); + if (input.readBoolean()) { + var verificationUrlTmp = new byte[input.readInt()]; + input.readFully(verificationUrlTmp); + this.verificationUrl = new String(verificationUrlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.success); + if (this.verificationUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var verificationUrlTmp = this.verificationUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(verificationUrlTmp.length); + output.write(verificationUrlTmp); + } + } } public static class PaymentsProviderStripe extends Object { @@ -9835,8 +26884,9 @@ public class TdApi { public boolean needPostalCode; public boolean needCardholderName; - public PaymentsProviderStripe() { - } + public static final int CONSTRUCTOR = 1090791032; + + public PaymentsProviderStripe() {} public PaymentsProviderStripe(String publishableKey, boolean needCountry, boolean needPostalCode, boolean needCardholderName) { this.publishableKey = publishableKey; @@ -9845,12 +26895,35 @@ public class TdApi { this.needCardholderName = needCardholderName; } - public static final int CONSTRUCTOR = 1090791032; + public PaymentsProviderStripe(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var publishableKeyTmp = new byte[input.readInt()]; + input.readFully(publishableKeyTmp); + this.publishableKey = new String(publishableKeyTmp, StandardCharsets.UTF_8); + } + this.needCountry = input.readBoolean(); + this.needPostalCode = input.readBoolean(); + this.needCardholderName = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.publishableKey == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var publishableKeyTmp = this.publishableKey.getBytes(StandardCharsets.UTF_8); + output.writeInt(publishableKeyTmp.length); + output.write(publishableKeyTmp); + } + output.writeBoolean(this.needCountry); + output.writeBoolean(this.needPostalCode); + output.writeBoolean(this.needCardholderName); + } } public static class PersonalDetails extends Object { @@ -9865,8 +26938,9 @@ public class TdApi { public String countryCode; public String residenceCountryCode; - public PersonalDetails() { - } + public static final int CONSTRUCTOR = -1061656137; + + public PersonalDetails() {} public PersonalDetails(String firstName, String middleName, String lastName, String nativeFirstName, String nativeMiddleName, String nativeLastName, Date birthdate, String gender, String countryCode, String residenceCountryCode) { this.firstName = firstName; @@ -9881,32 +26955,192 @@ public class TdApi { this.residenceCountryCode = residenceCountryCode; } - public static final int CONSTRUCTOR = -1061656137; + public PersonalDetails(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var firstNameTmp = new byte[input.readInt()]; + input.readFully(firstNameTmp); + this.firstName = new String(firstNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var middleNameTmp = new byte[input.readInt()]; + input.readFully(middleNameTmp); + this.middleName = new String(middleNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var lastNameTmp = new byte[input.readInt()]; + input.readFully(lastNameTmp); + this.lastName = new String(lastNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nativeFirstNameTmp = new byte[input.readInt()]; + input.readFully(nativeFirstNameTmp); + this.nativeFirstName = new String(nativeFirstNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nativeMiddleNameTmp = new byte[input.readInt()]; + input.readFully(nativeMiddleNameTmp); + this.nativeMiddleName = new String(nativeMiddleNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nativeLastNameTmp = new byte[input.readInt()]; + input.readFully(nativeLastNameTmp); + this.nativeLastName = new String(nativeLastNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Date.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.birthdate = new Date(input); + } + if (input.readBoolean()) { + var genderTmp = new byte[input.readInt()]; + input.readFully(genderTmp); + this.gender = new String(genderTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var countryCodeTmp = new byte[input.readInt()]; + input.readFully(countryCodeTmp); + this.countryCode = new String(countryCodeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var residenceCountryCodeTmp = new byte[input.readInt()]; + input.readFully(residenceCountryCodeTmp); + this.residenceCountryCode = new String(residenceCountryCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.firstName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var firstNameTmp = this.firstName.getBytes(StandardCharsets.UTF_8); + output.writeInt(firstNameTmp.length); + output.write(firstNameTmp); + } + if (this.middleName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var middleNameTmp = this.middleName.getBytes(StandardCharsets.UTF_8); + output.writeInt(middleNameTmp.length); + output.write(middleNameTmp); + } + if (this.lastName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var lastNameTmp = this.lastName.getBytes(StandardCharsets.UTF_8); + output.writeInt(lastNameTmp.length); + output.write(lastNameTmp); + } + if (this.nativeFirstName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nativeFirstNameTmp = this.nativeFirstName.getBytes(StandardCharsets.UTF_8); + output.writeInt(nativeFirstNameTmp.length); + output.write(nativeFirstNameTmp); + } + if (this.nativeMiddleName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nativeMiddleNameTmp = this.nativeMiddleName.getBytes(StandardCharsets.UTF_8); + output.writeInt(nativeMiddleNameTmp.length); + output.write(nativeMiddleNameTmp); + } + if (this.nativeLastName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nativeLastNameTmp = this.nativeLastName.getBytes(StandardCharsets.UTF_8); + output.writeInt(nativeLastNameTmp.length); + output.write(nativeLastNameTmp); + } + if (this.birthdate == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.birthdate.serialize(output); + } + if (this.gender == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var genderTmp = this.gender.getBytes(StandardCharsets.UTF_8); + output.writeInt(genderTmp.length); + output.write(genderTmp); + } + if (this.countryCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var countryCodeTmp = this.countryCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(countryCodeTmp.length); + output.write(countryCodeTmp); + } + if (this.residenceCountryCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var residenceCountryCodeTmp = this.residenceCountryCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(residenceCountryCodeTmp.length); + output.write(residenceCountryCodeTmp); + } + } } public static class PersonalDocument extends Object { public DatedFile[] files; public DatedFile[] translation; - public PersonalDocument() { - } + public static final int CONSTRUCTOR = -1011634661; + + public PersonalDocument() {} public PersonalDocument(DatedFile[] files, DatedFile[] translation) { this.files = files; this.translation = translation; } - public static final int CONSTRUCTOR = -1011634661; + public PersonalDocument(DataInputStream input) throws IOException { + this.files = new DatedFile[input.readInt()]; + for (int i = 0; i < this.files.length; i++) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.files[i] = new DatedFile(input); + } + this.translation = new DatedFile[input.readInt()]; + for (int i = 0; i < this.translation.length; i++) { + if (DatedFile.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.translation[i] = new DatedFile(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.files.length); + for (int i = 0; i < this.files.length; i++) { + this.files[i].serialize(output); + } + output.writeInt(this.translation.length); + for (int i = 0; i < this.translation.length; i++) { + this.translation[i].serialize(output); + } + } } public static class PhoneNumberAuthenticationSettings extends Object { @@ -9914,8 +27148,9 @@ public class TdApi { public boolean isCurrentPhoneNumber; public boolean allowSmsRetrieverApi; - public PhoneNumberAuthenticationSettings() { - } + public static final int CONSTRUCTOR = -859198743; + + public PhoneNumberAuthenticationSettings() {} public PhoneNumberAuthenticationSettings(boolean allowFlashCall, boolean isCurrentPhoneNumber, boolean allowSmsRetrieverApi) { this.allowFlashCall = allowFlashCall; @@ -9923,12 +27158,22 @@ public class TdApi { this.allowSmsRetrieverApi = allowSmsRetrieverApi; } - public static final int CONSTRUCTOR = -859198743; + public PhoneNumberAuthenticationSettings(DataInputStream input) throws IOException { + this.allowFlashCall = input.readBoolean(); + this.isCurrentPhoneNumber = input.readBoolean(); + this.allowSmsRetrieverApi = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.allowFlashCall); + output.writeBoolean(this.isCurrentPhoneNumber); + output.writeBoolean(this.allowSmsRetrieverApi); + } } public static class Photo extends Object { @@ -9936,8 +27181,9 @@ public class TdApi { public Minithumbnail minithumbnail; public PhotoSize[] sizes; - public Photo() { - } + public static final int CONSTRUCTOR = -2022871583; + + public Photo() {} public Photo(boolean hasStickers, Minithumbnail minithumbnail, PhotoSize[] sizes) { this.hasStickers = hasStickers; @@ -9945,12 +27191,41 @@ public class TdApi { this.sizes = sizes; } - public static final int CONSTRUCTOR = -2022871583; + public Photo(DataInputStream input) throws IOException { + this.hasStickers = input.readBoolean(); + if (input.readBoolean()) { + if (Minithumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.minithumbnail = new Minithumbnail(input); + } + this.sizes = new PhotoSize[input.readInt()]; + for (int i = 0; i < this.sizes.length; i++) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sizes[i] = new PhotoSize(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.hasStickers); + if (this.minithumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.minithumbnail.serialize(output); + } + output.writeInt(this.sizes.length); + for (int i = 0; i < this.sizes.length; i++) { + this.sizes[i].serialize(output); + } + } } public static class PhotoSize extends Object { @@ -9959,8 +27234,9 @@ public class TdApi { public int width; public int height; - public PhotoSize() { - } + public static final int CONSTRUCTOR = 421980227; + + public PhotoSize() {} public PhotoSize(String type, File photo, int width, int height) { this.type = type; @@ -9969,12 +27245,45 @@ public class TdApi { this.height = height; } - public static final int CONSTRUCTOR = 421980227; + public PhotoSize(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var typeTmp = new byte[input.readInt()]; + input.readFully(typeTmp); + this.type = new String(typeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new File(input); + } + this.width = input.readInt(); + this.height = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var typeTmp = this.type.getBytes(StandardCharsets.UTF_8); + output.writeInt(typeTmp.length); + output.write(typeTmp); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + output.writeInt(this.width); + output.writeInt(this.height); + } } public static class Poll extends Object { @@ -9989,8 +27298,9 @@ public class TdApi { public int closeDate; public boolean isClosed; - public Poll() { - } + public static final int CONSTRUCTOR = 163256789; + + public Poll() {} public Poll(long id, String question, PollOption[] options, int totalVoterCount, int[] recentVoterUserIds, boolean isAnonymous, PollType type, int openPeriod, int closeDate, boolean isClosed) { this.id = id; @@ -10005,12 +27315,78 @@ public class TdApi { this.isClosed = isClosed; } - public static final int CONSTRUCTOR = 163256789; + public Poll(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var questionTmp = new byte[input.readInt()]; + input.readFully(questionTmp); + this.question = new String(questionTmp, StandardCharsets.UTF_8); + } + this.options = new PollOption[input.readInt()]; + for (int i = 0; i < this.options.length; i++) { + if (PollOption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.options[i] = new PollOption(input); + } + this.totalVoterCount = input.readInt(); + this.recentVoterUserIds = new int[input.readInt()]; + for (int i = 0; i < this.recentVoterUserIds.length; i++) { + this.recentVoterUserIds[i] = input.readInt(); + } + this.isAnonymous = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case PollTypeRegular.CONSTRUCTOR: + this.type = new PollTypeRegular(input); + break; + case PollTypeQuiz.CONSTRUCTOR: + this.type = new PollTypeQuiz(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.openPeriod = input.readInt(); + this.closeDate = input.readInt(); + this.isClosed = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.question == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var questionTmp = this.question.getBytes(StandardCharsets.UTF_8); + output.writeInt(questionTmp.length); + output.write(questionTmp); + } + output.writeInt(this.options.length); + for (int i = 0; i < this.options.length; i++) { + this.options[i].serialize(output); + } + output.writeInt(this.totalVoterCount); + output.writeInt(this.recentVoterUserIds.length); + for (int i = 0; i < this.recentVoterUserIds.length; i++) { + output.writeInt(this.recentVoterUserIds[i]); + } + output.writeBoolean(this.isAnonymous); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeInt(this.openPeriod); + output.writeInt(this.closeDate); + output.writeBoolean(this.isClosed); + } } public static class PollOption extends Object { @@ -10020,8 +27396,9 @@ public class TdApi { public boolean isChosen; public boolean isBeingChosen; - public PollOption() { - } + public static final int CONSTRUCTOR = 1473893797; + + public PollOption() {} public PollOption(String text, int voterCount, int votePercentage, boolean isChosen, boolean isBeingChosen) { this.text = text; @@ -10031,53 +27408,101 @@ public class TdApi { this.isBeingChosen = isBeingChosen; } - public static final int CONSTRUCTOR = 1473893797; + public PollOption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + this.voterCount = input.readInt(); + this.votePercentage = input.readInt(); + this.isChosen = input.readBoolean(); + this.isBeingChosen = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PollType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + output.writeInt(this.voterCount); + output.writeInt(this.votePercentage); + output.writeBoolean(this.isChosen); + output.writeBoolean(this.isBeingChosen); + } } public static class PollTypeRegular extends PollType { public boolean allowMultipleAnswers; - public PollTypeRegular() { - } + public static final int CONSTRUCTOR = 641265698; + + public PollTypeRegular() {} public PollTypeRegular(boolean allowMultipleAnswers) { this.allowMultipleAnswers = allowMultipleAnswers; } - public static final int CONSTRUCTOR = 641265698; + public PollTypeRegular(DataInputStream input) throws IOException { + this.allowMultipleAnswers = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.allowMultipleAnswers); + } } public static class PollTypeQuiz extends PollType { public int correctOptionId; public FormattedText explanation; - public PollTypeQuiz() { - } + public static final int CONSTRUCTOR = 657013913; + + public PollTypeQuiz() {} public PollTypeQuiz(int correctOptionId, FormattedText explanation) { this.correctOptionId = correctOptionId; this.explanation = explanation; } - public static final int CONSTRUCTOR = 657013913; + public PollTypeQuiz(DataInputStream input) throws IOException { + this.correctOptionId = input.readInt(); + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.explanation = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.correctOptionId); + if (this.explanation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.explanation.serialize(output); + } + } } public static class ProfilePhoto extends Object { @@ -10085,8 +27510,9 @@ public class TdApi { public File small; public File big; - public ProfilePhoto() { - } + public static final int CONSTRUCTOR = 978085937; + + public ProfilePhoto() {} public ProfilePhoto(long id, File small, File big) { this.id = id; @@ -10094,30 +27520,76 @@ public class TdApi { this.big = big; } - public static final int CONSTRUCTOR = 978085937; + public ProfilePhoto(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.small = new File(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.big = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.small == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.small.serialize(output); + } + if (this.big == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.big.serialize(output); + } + } } public static class Proxies extends Object { public Proxy[] proxies; - public Proxies() { - } + public static final int CONSTRUCTOR = 1200447205; + + public Proxies() {} public Proxies(Proxy[] proxies) { this.proxies = proxies; } - public static final int CONSTRUCTOR = 1200447205; + public Proxies(DataInputStream input) throws IOException { + this.proxies = new Proxy[input.readInt()]; + for (int i = 0; i < this.proxies.length; i++) { + if (Proxy.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.proxies[i] = new Proxy(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.proxies.length); + for (int i = 0; i < this.proxies.length; i++) { + this.proxies[i].serialize(output); + } + } } public static class Proxy extends Object { @@ -10128,8 +27600,9 @@ public class TdApi { public boolean isEnabled; public ProxyType type; - public Proxy() { - } + public static final int CONSTRUCTOR = 196049779; + + public Proxy() {} public Proxy(int id, String server, int port, int lastUsedDate, boolean isEnabled, ProxyType type) { this.id = id; @@ -10140,35 +27613,109 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = 196049779; + public Proxy(DataInputStream input) throws IOException { + this.id = input.readInt(); + if (input.readBoolean()) { + var serverTmp = new byte[input.readInt()]; + input.readFully(serverTmp); + this.server = new String(serverTmp, StandardCharsets.UTF_8); + } + this.port = input.readInt(); + this.lastUsedDate = input.readInt(); + this.isEnabled = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ProxyTypeSocks5.CONSTRUCTOR: + this.type = new ProxyTypeSocks5(input); + break; + case ProxyTypeHttp.CONSTRUCTOR: + this.type = new ProxyTypeHttp(input); + break; + case ProxyTypeMtproto.CONSTRUCTOR: + this.type = new ProxyTypeMtproto(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ProxyType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + if (this.server == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var serverTmp = this.server.getBytes(StandardCharsets.UTF_8); + output.writeInt(serverTmp.length); + output.write(serverTmp); + } + output.writeInt(this.port); + output.writeInt(this.lastUsedDate); + output.writeBoolean(this.isEnabled); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class ProxyTypeSocks5 extends ProxyType { public String username; public String password; - public ProxyTypeSocks5() { - } + public static final int CONSTRUCTOR = -890027341; + + public ProxyTypeSocks5() {} public ProxyTypeSocks5(String username, String password) { this.username = username; this.password = password; } - public static final int CONSTRUCTOR = -890027341; + public ProxyTypeSocks5(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class ProxyTypeHttp extends ProxyType { @@ -10176,8 +27723,9 @@ public class TdApi { public String password; public boolean httpOnly; - public ProxyTypeHttp() { - } + public static final int CONSTRUCTOR = -1547188361; + + public ProxyTypeHttp() {} public ProxyTypeHttp(String username, String password, boolean httpOnly) { this.username = username; @@ -10185,100 +27733,192 @@ public class TdApi { this.httpOnly = httpOnly; } - public static final int CONSTRUCTOR = -1547188361; + public ProxyTypeHttp(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + this.httpOnly = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + output.writeBoolean(this.httpOnly); + } } public static class ProxyTypeMtproto extends ProxyType { public String secret; - public ProxyTypeMtproto() { - } + public static final int CONSTRUCTOR = -1964826627; + + public ProxyTypeMtproto() {} public ProxyTypeMtproto(String secret) { this.secret = secret; } - public static final int CONSTRUCTOR = -1964826627; + public ProxyTypeMtproto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var secretTmp = new byte[input.readInt()]; + input.readFully(secretTmp); + this.secret = new String(secretTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PublicChatType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.secret == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var secretTmp = this.secret.getBytes(StandardCharsets.UTF_8); + output.writeInt(secretTmp.length); + output.write(secretTmp); + } + } } public static class PublicChatTypeHasUsername extends PublicChatType { - - public PublicChatTypeHasUsername() { - } - public static final int CONSTRUCTOR = 350789758; - @Override + public PublicChatTypeHasUsername() {} + + + public PublicChatTypeHasUsername(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PublicChatTypeIsLocationBased extends PublicChatType { - - public PublicChatTypeIsLocationBased() { - } - public static final int CONSTRUCTOR = 1183735952; - @Override + public PublicChatTypeIsLocationBased() {} + + + public PublicChatTypeIsLocationBased(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PublicMessageLink extends Object { public String link; public String html; - public PublicMessageLink() { - } + public static final int CONSTRUCTOR = -679603433; + + public PublicMessageLink() {} public PublicMessageLink(String link, String html) { this.link = link; this.html = html; } - public static final int CONSTRUCTOR = -679603433; + public PublicMessageLink(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var linkTmp = new byte[input.readInt()]; + input.readFully(linkTmp); + this.link = new String(linkTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var htmlTmp = new byte[input.readInt()]; + input.readFully(htmlTmp); + this.html = new String(htmlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class PushMessageContent extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.link == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var linkTmp = this.link.getBytes(StandardCharsets.UTF_8); + output.writeInt(linkTmp.length); + output.write(linkTmp); + } + if (this.html == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var htmlTmp = this.html.getBytes(StandardCharsets.UTF_8); + output.writeInt(htmlTmp.length); + output.write(htmlTmp); + } + } } public static class PushMessageContentHidden extends PushMessageContent { public boolean isPinned; - public PushMessageContentHidden() { - } + public static final int CONSTRUCTOR = -316950436; + + public PushMessageContentHidden() {} public PushMessageContentHidden(boolean isPinned) { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -316950436; + public PushMessageContentHidden(DataInputStream input) throws IOException { + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentAnimation extends PushMessageContent { @@ -10286,8 +27926,9 @@ public class TdApi { public String caption; public boolean isPinned; - public PushMessageContentAnimation() { - } + public static final int CONSTRUCTOR = 1034215396; + + public PushMessageContentAnimation() {} public PushMessageContentAnimation(Animation animation, String caption, boolean isPinned) { this.animation = animation; @@ -10295,105 +27936,219 @@ public class TdApi { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 1034215396; + public PushMessageContentAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new Animation(input); + } + if (input.readBoolean()) { + var captionTmp = new byte[input.readInt()]; + input.readFully(captionTmp); + this.caption = new String(captionTmp, StandardCharsets.UTF_8); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var captionTmp = this.caption.getBytes(StandardCharsets.UTF_8); + output.writeInt(captionTmp.length); + output.write(captionTmp); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentAudio extends PushMessageContent { public Audio audio; public boolean isPinned; - public PushMessageContentAudio() { - } + public static final int CONSTRUCTOR = 381581426; + + public PushMessageContentAudio() {} public PushMessageContentAudio(Audio audio, boolean isPinned) { this.audio = audio; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 381581426; + public PushMessageContentAudio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Audio.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.audio = new Audio(input); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentContact extends PushMessageContent { public String name; public boolean isPinned; - public PushMessageContentContact() { - } + public static final int CONSTRUCTOR = -12219820; + + public PushMessageContentContact() {} public PushMessageContentContact(String name, boolean isPinned) { this.name = name; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -12219820; + public PushMessageContentContact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentContactRegistered extends PushMessageContent { - - public PushMessageContentContactRegistered() { - } - public static final int CONSTRUCTOR = -303962720; - @Override + public PushMessageContentContactRegistered() {} + + + public PushMessageContentContactRegistered(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PushMessageContentDocument extends PushMessageContent { public Document document; public boolean isPinned; - public PushMessageContentDocument() { - } + public static final int CONSTRUCTOR = -458379775; + + public PushMessageContentDocument() {} public PushMessageContentDocument(Document document, boolean isPinned) { this.document = document; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -458379775; + public PushMessageContentDocument(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Document.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new Document(input); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentGame extends PushMessageContent { public String title; public boolean isPinned; - public PushMessageContentGame() { - } + public static final int CONSTRUCTOR = -515131109; + + public PushMessageContentGame() {} public PushMessageContentGame(String title, boolean isPinned) { this.title = title; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -515131109; + public PushMessageContentGame(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentGameScore extends PushMessageContent { @@ -10401,8 +28156,9 @@ public class TdApi { public int score; public boolean isPinned; - public PushMessageContentGameScore() { - } + public static final int CONSTRUCTOR = 901303688; + + public PushMessageContentGameScore() {} public PushMessageContentGameScore(String title, int score, boolean isPinned) { this.title = title; @@ -10410,52 +28166,102 @@ public class TdApi { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 901303688; + public PushMessageContentGameScore(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.score = input.readInt(); + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeInt(this.score); + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentInvoice extends PushMessageContent { public String price; public boolean isPinned; - public PushMessageContentInvoice() { - } + public static final int CONSTRUCTOR = -1731687492; + + public PushMessageContentInvoice() {} public PushMessageContentInvoice(String price, boolean isPinned) { this.price = price; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -1731687492; + public PushMessageContentInvoice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var priceTmp = new byte[input.readInt()]; + input.readFully(priceTmp); + this.price = new String(priceTmp, StandardCharsets.UTF_8); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.price == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var priceTmp = this.price.getBytes(StandardCharsets.UTF_8); + output.writeInt(priceTmp.length); + output.write(priceTmp); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentLocation extends PushMessageContent { public boolean isLive; public boolean isPinned; - public PushMessageContentLocation() { - } + public static final int CONSTRUCTOR = -1288005709; + + public PushMessageContentLocation() {} public PushMessageContentLocation(boolean isLive, boolean isPinned) { this.isLive = isLive; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -1288005709; + public PushMessageContentLocation(DataInputStream input) throws IOException { + this.isLive = input.readBoolean(); + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isLive); + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentPhoto extends PushMessageContent { @@ -10464,8 +28270,9 @@ public class TdApi { public boolean isSecret; public boolean isPinned; - public PushMessageContentPhoto() { - } + public static final int CONSTRUCTOR = 140631122; + + public PushMessageContentPhoto() {} public PushMessageContentPhoto(Photo photo, String caption, boolean isSecret, boolean isPinned) { this.photo = photo; @@ -10474,12 +28281,45 @@ public class TdApi { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 140631122; + public PushMessageContentPhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + var captionTmp = new byte[input.readInt()]; + input.readFully(captionTmp); + this.caption = new String(captionTmp, StandardCharsets.UTF_8); + } + this.isSecret = input.readBoolean(); + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var captionTmp = this.caption.getBytes(StandardCharsets.UTF_8); + output.writeInt(captionTmp.length); + output.write(captionTmp); + } + output.writeBoolean(this.isSecret); + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentPoll extends PushMessageContent { @@ -10487,8 +28327,9 @@ public class TdApi { public boolean isRegular; public boolean isPinned; - public PushMessageContentPoll() { - } + public static final int CONSTRUCTOR = -44403654; + + public PushMessageContentPoll() {} public PushMessageContentPoll(String question, boolean isRegular, boolean isPinned) { this.question = question; @@ -10496,25 +28337,51 @@ public class TdApi { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -44403654; + public PushMessageContentPoll(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var questionTmp = new byte[input.readInt()]; + input.readFully(questionTmp); + this.question = new String(questionTmp, StandardCharsets.UTF_8); + } + this.isRegular = input.readBoolean(); + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.question == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var questionTmp = this.question.getBytes(StandardCharsets.UTF_8); + output.writeInt(questionTmp.length); + output.write(questionTmp); + } + output.writeBoolean(this.isRegular); + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentScreenshotTaken extends PushMessageContent { - - public PushMessageContentScreenshotTaken() { - } - public static final int CONSTRUCTOR = 214245369; - @Override + public PushMessageContentScreenshotTaken() {} + + + public PushMessageContentScreenshotTaken(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PushMessageContentSticker extends PushMessageContent { @@ -10522,8 +28389,9 @@ public class TdApi { public String emoji; public boolean isPinned; - public PushMessageContentSticker() { - } + public static final int CONSTRUCTOR = 1553513939; + + public PushMessageContentSticker() {} public PushMessageContentSticker(Sticker sticker, String emoji, boolean isPinned) { this.sticker = sticker; @@ -10531,32 +28399,83 @@ public class TdApi { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 1553513939; + public PushMessageContentSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sticker = new Sticker(input); + } + if (input.readBoolean()) { + var emojiTmp = new byte[input.readInt()]; + input.readFully(emojiTmp); + this.emoji = new String(emojiTmp, StandardCharsets.UTF_8); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + if (this.emoji == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojiTmp = this.emoji.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojiTmp.length); + output.write(emojiTmp); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentText extends PushMessageContent { public String text; public boolean isPinned; - public PushMessageContentText() { - } + public static final int CONSTRUCTOR = 274587305; + + public PushMessageContentText() {} public PushMessageContentText(String text, boolean isPinned) { this.text = text; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 274587305; + public PushMessageContentText(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentVideo extends PushMessageContent { @@ -10565,8 +28484,9 @@ public class TdApi { public boolean isSecret; public boolean isPinned; - public PushMessageContentVideo() { - } + public static final int CONSTRUCTOR = 310038831; + + public PushMessageContentVideo() {} public PushMessageContentVideo(Video video, String caption, boolean isSecret, boolean isPinned) { this.video = video; @@ -10575,65 +28495,141 @@ public class TdApi { this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 310038831; + public PushMessageContentVideo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Video.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new Video(input); + } + if (input.readBoolean()) { + var captionTmp = new byte[input.readInt()]; + input.readFully(captionTmp); + this.caption = new String(captionTmp, StandardCharsets.UTF_8); + } + this.isSecret = input.readBoolean(); + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var captionTmp = this.caption.getBytes(StandardCharsets.UTF_8); + output.writeInt(captionTmp.length); + output.write(captionTmp); + } + output.writeBoolean(this.isSecret); + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentVideoNote extends PushMessageContent { public VideoNote videoNote; public boolean isPinned; - public PushMessageContentVideoNote() { - } + public static final int CONSTRUCTOR = -1122764417; + + public PushMessageContentVideoNote() {} public PushMessageContentVideoNote(VideoNote videoNote, boolean isPinned) { this.videoNote = videoNote; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -1122764417; + public PushMessageContentVideoNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (VideoNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.videoNote = new VideoNote(input); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.videoNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.videoNote.serialize(output); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentVoiceNote extends PushMessageContent { public VoiceNote voiceNote; public boolean isPinned; - public PushMessageContentVoiceNote() { - } + public static final int CONSTRUCTOR = 88910987; + + public PushMessageContentVoiceNote() {} public PushMessageContentVoiceNote(VoiceNote voiceNote, boolean isPinned) { this.voiceNote = voiceNote; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = 88910987; + public PushMessageContentVoiceNote(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (VoiceNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.voiceNote = new VoiceNote(input); + } + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.voiceNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voiceNote.serialize(output); + } + output.writeBoolean(this.isPinned); + } } public static class PushMessageContentBasicGroupChatCreate extends PushMessageContent { - - public PushMessageContentBasicGroupChatCreate() { - } - public static final int CONSTRUCTOR = -2114855172; - @Override + public PushMessageContentBasicGroupChatCreate() {} + + + public PushMessageContentBasicGroupChatCreate(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PushMessageContentChatAddMembers extends PushMessageContent { @@ -10641,8 +28637,9 @@ public class TdApi { public boolean isCurrentUser; public boolean isReturned; - public PushMessageContentChatAddMembers() { - } + public static final int CONSTRUCTOR = -1087145158; + + public PushMessageContentChatAddMembers() {} public PushMessageContentChatAddMembers(String memberName, boolean isCurrentUser, boolean isReturned) { this.memberName = memberName; @@ -10650,43 +28647,87 @@ public class TdApi { this.isReturned = isReturned; } - public static final int CONSTRUCTOR = -1087145158; + public PushMessageContentChatAddMembers(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var memberNameTmp = new byte[input.readInt()]; + input.readFully(memberNameTmp); + this.memberName = new String(memberNameTmp, StandardCharsets.UTF_8); + } + this.isCurrentUser = input.readBoolean(); + this.isReturned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.memberName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var memberNameTmp = this.memberName.getBytes(StandardCharsets.UTF_8); + output.writeInt(memberNameTmp.length); + output.write(memberNameTmp); + } + output.writeBoolean(this.isCurrentUser); + output.writeBoolean(this.isReturned); + } } public static class PushMessageContentChatChangePhoto extends PushMessageContent { - - public PushMessageContentChatChangePhoto() { - } - public static final int CONSTRUCTOR = -1114222051; - @Override + public PushMessageContentChatChangePhoto() {} + + + public PushMessageContentChatChangePhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PushMessageContentChatChangeTitle extends PushMessageContent { public String title; - public PushMessageContentChatChangeTitle() { - } + public static final int CONSTRUCTOR = -1964902749; + + public PushMessageContentChatChangeTitle() {} public PushMessageContentChatChangeTitle(String title) { this.title = title; } - public static final int CONSTRUCTOR = -1964902749; + public PushMessageContentChatChangeTitle(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class PushMessageContentChatDeleteMember extends PushMessageContent { @@ -10694,8 +28735,9 @@ public class TdApi { public boolean isCurrentUser; public boolean isLeft; - public PushMessageContentChatDeleteMember() { - } + public static final int CONSTRUCTOR = 598714783; + + public PushMessageContentChatDeleteMember() {} public PushMessageContentChatDeleteMember(String memberName, boolean isCurrentUser, boolean isLeft) { this.memberName = memberName; @@ -10703,43 +28745,76 @@ public class TdApi { this.isLeft = isLeft; } - public static final int CONSTRUCTOR = 598714783; + public PushMessageContentChatDeleteMember(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var memberNameTmp = new byte[input.readInt()]; + input.readFully(memberNameTmp); + this.memberName = new String(memberNameTmp, StandardCharsets.UTF_8); + } + this.isCurrentUser = input.readBoolean(); + this.isLeft = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.memberName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var memberNameTmp = this.memberName.getBytes(StandardCharsets.UTF_8); + output.writeInt(memberNameTmp.length); + output.write(memberNameTmp); + } + output.writeBoolean(this.isCurrentUser); + output.writeBoolean(this.isLeft); + } } public static class PushMessageContentChatJoinByLink extends PushMessageContent { - - public PushMessageContentChatJoinByLink() { - } - public static final int CONSTRUCTOR = 1553719113; - @Override + public PushMessageContentChatJoinByLink() {} + + + public PushMessageContentChatJoinByLink(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class PushMessageContentMessageForwards extends PushMessageContent { public int totalCount; - public PushMessageContentMessageForwards() { - } + public static final int CONSTRUCTOR = -1913083876; + + public PushMessageContentMessageForwards() {} public PushMessageContentMessageForwards(int totalCount) { this.totalCount = totalCount; } - public static final int CONSTRUCTOR = -1913083876; + public PushMessageContentMessageForwards(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + } } public static class PushMessageContentMediaAlbum extends PushMessageContent { @@ -10747,8 +28822,9 @@ public class TdApi { public boolean hasPhotos; public boolean hasVideos; - public PushMessageContentMediaAlbum() { - } + public static final int CONSTRUCTOR = -874278109; + + public PushMessageContentMediaAlbum() {} public PushMessageContentMediaAlbum(int totalCount, boolean hasPhotos, boolean hasVideos) { this.totalCount = totalCount; @@ -10756,48 +28832,83 @@ public class TdApi { this.hasVideos = hasVideos; } - public static final int CONSTRUCTOR = -874278109; + public PushMessageContentMediaAlbum(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + this.hasPhotos = input.readBoolean(); + this.hasVideos = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + output.writeBoolean(this.hasPhotos); + output.writeBoolean(this.hasVideos); + } } public static class PushReceiverId extends Object { public long id; - public PushReceiverId() { - } + public static final int CONSTRUCTOR = 371056428; + + public PushReceiverId() {} public PushReceiverId(long id) { this.id = id; } - public static final int CONSTRUCTOR = 371056428; + public PushReceiverId(DataInputStream input) throws IOException { + this.id = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + } } public static class RecoveryEmailAddress extends Object { public String recoveryEmailAddress; - public RecoveryEmailAddress() { - } + public static final int CONSTRUCTOR = 1290526187; + + public RecoveryEmailAddress() {} public RecoveryEmailAddress(String recoveryEmailAddress) { this.recoveryEmailAddress = recoveryEmailAddress; } - public static final int CONSTRUCTOR = 1290526187; + public RecoveryEmailAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var recoveryEmailAddressTmp = new byte[input.readInt()]; + input.readFully(recoveryEmailAddressTmp); + this.recoveryEmailAddress = new String(recoveryEmailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.recoveryEmailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var recoveryEmailAddressTmp = this.recoveryEmailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(recoveryEmailAddressTmp.length); + output.write(recoveryEmailAddressTmp); + } + } } public static class RemoteFile extends Object { @@ -10807,8 +28918,9 @@ public class TdApi { public boolean isUploadingCompleted; public int uploadedSize; - public RemoteFile() { - } + public static final int CONSTRUCTOR = -1822143022; + + public RemoteFile() {} public RemoteFile(String id, String uniqueId, boolean isUploadingActive, boolean isUploadingCompleted, int uploadedSize) { this.id = id; @@ -10818,51 +28930,98 @@ public class TdApi { this.uploadedSize = uploadedSize; } - public static final int CONSTRUCTOR = -1822143022; + public RemoteFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var uniqueIdTmp = new byte[input.readInt()]; + input.readFully(uniqueIdTmp); + this.uniqueId = new String(uniqueIdTmp, StandardCharsets.UTF_8); + } + this.isUploadingActive = input.readBoolean(); + this.isUploadingCompleted = input.readBoolean(); + this.uploadedSize = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class ReplyMarkup extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.uniqueId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var uniqueIdTmp = this.uniqueId.getBytes(StandardCharsets.UTF_8); + output.writeInt(uniqueIdTmp.length); + output.write(uniqueIdTmp); + } + output.writeBoolean(this.isUploadingActive); + output.writeBoolean(this.isUploadingCompleted); + output.writeInt(this.uploadedSize); + } } public static class ReplyMarkupRemoveKeyboard extends ReplyMarkup { public boolean isPersonal; - public ReplyMarkupRemoveKeyboard() { - } + public static final int CONSTRUCTOR = -691252879; + + public ReplyMarkupRemoveKeyboard() {} public ReplyMarkupRemoveKeyboard(boolean isPersonal) { this.isPersonal = isPersonal; } - public static final int CONSTRUCTOR = -691252879; + public ReplyMarkupRemoveKeyboard(DataInputStream input) throws IOException { + this.isPersonal = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isPersonal); + } } public static class ReplyMarkupForceReply extends ReplyMarkup { public boolean isPersonal; - public ReplyMarkupForceReply() { - } + public static final int CONSTRUCTOR = 1039104593; + + public ReplyMarkupForceReply() {} public ReplyMarkupForceReply(boolean isPersonal) { this.isPersonal = isPersonal; } - public static final int CONSTRUCTOR = 1039104593; + public ReplyMarkupForceReply(DataInputStream input) throws IOException { + this.isPersonal = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isPersonal); + } } public static class ReplyMarkupShowKeyboard extends ReplyMarkup { @@ -10871,8 +29030,9 @@ public class TdApi { public boolean oneTime; public boolean isPersonal; - public ReplyMarkupShowKeyboard() { - } + public static final int CONSTRUCTOR = -992627133; + + public ReplyMarkupShowKeyboard() {} public ReplyMarkupShowKeyboard(KeyboardButton[][] rows, boolean resizeKeyboard, boolean oneTime, boolean isPersonal) { this.rows = rows; @@ -10881,141 +29041,545 @@ public class TdApi { this.isPersonal = isPersonal; } - public static final int CONSTRUCTOR = -992627133; + public ReplyMarkupShowKeyboard(DataInputStream input) throws IOException { + this.rows = new KeyboardButton[input.readInt()][]; + for (int i = 0; i < this.rows.length; i++) { + this.rows[i] = new KeyboardButton[input.readInt()]; + for (int j = 0; j < this.rows[i].length; j++) { + if (KeyboardButton.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.rows[i][j] = new KeyboardButton(input); + } + } + this.resizeKeyboard = input.readBoolean(); + this.oneTime = input.readBoolean(); + this.isPersonal = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.rows.length); + for (int i = 0; i < this.rows.length; i++) { + output.writeInt(this.rows[i].length); + for (int j = 0; j < this.rows[i].length; j++) { + this.rows[i][j].serialize(output); + } + } + output.writeBoolean(this.resizeKeyboard); + output.writeBoolean(this.oneTime); + output.writeBoolean(this.isPersonal); + } } public static class ReplyMarkupInlineKeyboard extends ReplyMarkup { public InlineKeyboardButton[][] rows; - public ReplyMarkupInlineKeyboard() { - } + public static final int CONSTRUCTOR = -619317658; + + public ReplyMarkupInlineKeyboard() {} public ReplyMarkupInlineKeyboard(InlineKeyboardButton[][] rows) { this.rows = rows; } - public static final int CONSTRUCTOR = -619317658; + public ReplyMarkupInlineKeyboard(DataInputStream input) throws IOException { + this.rows = new InlineKeyboardButton[input.readInt()][]; + for (int i = 0; i < this.rows.length; i++) { + this.rows[i] = new InlineKeyboardButton[input.readInt()]; + for (int j = 0; j < this.rows[i].length; j++) { + if (InlineKeyboardButton.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.rows[i][j] = new InlineKeyboardButton(input); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class RichText extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.rows.length); + for (int i = 0; i < this.rows.length; i++) { + output.writeInt(this.rows[i].length); + for (int j = 0; j < this.rows[i].length; j++) { + this.rows[i][j].serialize(output); + } + } + } } public static class RichTextPlain extends RichText { public String text; - public RichTextPlain() { - } + public static final int CONSTRUCTOR = 482617702; + + public RichTextPlain() {} public RichTextPlain(String text) { this.text = text; } - public static final int CONSTRUCTOR = 482617702; + public RichTextPlain(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + } } public static class RichTextBold extends RichText { public RichText text; - public RichTextBold() { - } + public static final int CONSTRUCTOR = 1670844268; + + public RichTextBold() {} public RichTextBold(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = 1670844268; + public RichTextBold(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextItalic extends RichText { public RichText text; - public RichTextItalic() { - } + public static final int CONSTRUCTOR = 1853354047; + + public RichTextItalic() {} public RichTextItalic(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = 1853354047; + public RichTextItalic(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextUnderline extends RichText { public RichText text; - public RichTextUnderline() { - } + public static final int CONSTRUCTOR = -536019572; + + public RichTextUnderline() {} public RichTextUnderline(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = -536019572; + public RichTextUnderline(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextStrikethrough extends RichText { public RichText text; - public RichTextStrikethrough() { - } + public static final int CONSTRUCTOR = 723413585; + + public RichTextStrikethrough() {} public RichTextStrikethrough(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = 723413585; + public RichTextStrikethrough(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextFixed extends RichText { public RichText text; - public RichTextFixed() { - } + public static final int CONSTRUCTOR = -1271496249; + + public RichTextFixed() {} public RichTextFixed(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = -1271496249; + public RichTextFixed(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextUrl extends RichText { @@ -11023,8 +29587,9 @@ public class TdApi { public String url; public boolean isCached; - public RichTextUrl() { - } + public static final int CONSTRUCTOR = 83939092; + + public RichTextUrl() {} public RichTextUrl(RichText text, String url, boolean isCached) { this.text = text; @@ -11032,106 +29597,554 @@ public class TdApi { this.isCached = isCached; } - public static final int CONSTRUCTOR = 83939092; + public RichTextUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.isCached = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeBoolean(this.isCached); + } } public static class RichTextEmailAddress extends RichText { public RichText text; public String emailAddress; - public RichTextEmailAddress() { - } + public static final int CONSTRUCTOR = 40018679; + + public RichTextEmailAddress() {} public RichTextEmailAddress(RichText text, String emailAddress) { this.text = text; this.emailAddress = emailAddress; } - public static final int CONSTRUCTOR = 40018679; + public RichTextEmailAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var emailAddressTmp = new byte[input.readInt()]; + input.readFully(emailAddressTmp); + this.emailAddress = new String(emailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.emailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emailAddressTmp = this.emailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(emailAddressTmp.length); + output.write(emailAddressTmp); + } + } } public static class RichTextSubscript extends RichText { public RichText text; - public RichTextSubscript() { - } + public static final int CONSTRUCTOR = -868197812; + + public RichTextSubscript() {} public RichTextSubscript(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = -868197812; + public RichTextSubscript(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextSuperscript extends RichText { public RichText text; - public RichTextSuperscript() { - } + public static final int CONSTRUCTOR = -382241437; + + public RichTextSuperscript() {} public RichTextSuperscript(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = -382241437; + public RichTextSuperscript(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextMarked extends RichText { public RichText text; - public RichTextMarked() { - } + public static final int CONSTRUCTOR = -1271999614; + + public RichTextMarked() {} public RichTextMarked(RichText text) { this.text = text; } - public static final int CONSTRUCTOR = -1271999614; + public RichTextMarked(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class RichTextPhoneNumber extends RichText { public RichText text; public String phoneNumber; - public RichTextPhoneNumber() { - } + public static final int CONSTRUCTOR = 128521539; + + public RichTextPhoneNumber() {} public RichTextPhoneNumber(RichText text, String phoneNumber) { this.text = text; this.phoneNumber = phoneNumber; } - public static final int CONSTRUCTOR = 128521539; + public RichTextPhoneNumber(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + } } public static class RichTextIcon extends RichText { @@ -11139,8 +30152,9 @@ public class TdApi { public int width; public int height; - public RichTextIcon() { - } + public static final int CONSTRUCTOR = -1480316158; + + public RichTextIcon() {} public RichTextIcon(Document document, int width, int height) { this.document = document; @@ -11148,12 +30162,32 @@ public class TdApi { this.height = height; } - public static final int CONSTRUCTOR = -1480316158; + public RichTextIcon(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Document.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new Document(input); + } + this.width = input.readInt(); + this.height = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + output.writeInt(this.width); + output.writeInt(this.height); + } } public static class RichTextReference extends RichText { @@ -11161,8 +30195,9 @@ public class TdApi { public RichText referenceText; public String url; - public RichTextReference() { - } + public static final int CONSTRUCTOR = -144433301; + + public RichTextReference() {} public RichTextReference(RichText text, RichText referenceText, String url) { this.text = text; @@ -11170,30 +30205,191 @@ public class TdApi { this.url = url; } - public static final int CONSTRUCTOR = -144433301; + public RichTextReference(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.referenceText = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.referenceText = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.referenceText = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.referenceText = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.referenceText = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.referenceText = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.referenceText = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.referenceText = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.referenceText = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.referenceText = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.referenceText = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.referenceText = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.referenceText = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.referenceText = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.referenceText = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.referenceText = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.referenceText = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.referenceText == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.referenceText.serialize(output); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class RichTextAnchor extends RichText { public String name; - public RichTextAnchor() { - } + public static final int CONSTRUCTOR = 1316950068; + + public RichTextAnchor() {} public RichTextAnchor(String name) { this.name = name; } - public static final int CONSTRUCTOR = 1316950068; + public RichTextAnchor(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + } } public static class RichTextAnchorLink extends RichText { @@ -11201,8 +30397,9 @@ public class TdApi { public String name; public String url; - public RichTextAnchorLink() { - } + public static final int CONSTRUCTOR = -367827961; + + public RichTextAnchorLink() {} public RichTextAnchorLink(RichText text, String name, String url) { this.text = text; @@ -11210,50 +30407,241 @@ public class TdApi { this.url = url; } - public static final int CONSTRUCTOR = -367827961; + public RichTextAnchorLink(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.text = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.text = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.text = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.text = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.text = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.text = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.text = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.text = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.text = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.text = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.text = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.text = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.text = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.text = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.text = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.text = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.text = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class RichTexts extends RichText { public RichText[] texts; - public RichTexts() { - } + public static final int CONSTRUCTOR = 1647457821; + + public RichTexts() {} public RichTexts(RichText[] texts) { this.texts = texts; } - public static final int CONSTRUCTOR = 1647457821; + public RichTexts(DataInputStream input) throws IOException { + this.texts = new RichText[input.readInt()]; + for (int i = 0; i < this.texts.length; i++) { + switch(input.readInt()) { + case RichTextPlain.CONSTRUCTOR: + this.texts[i] = new RichTextPlain(input); + break; + case RichTextBold.CONSTRUCTOR: + this.texts[i] = new RichTextBold(input); + break; + case RichTextItalic.CONSTRUCTOR: + this.texts[i] = new RichTextItalic(input); + break; + case RichTextUnderline.CONSTRUCTOR: + this.texts[i] = new RichTextUnderline(input); + break; + case RichTextStrikethrough.CONSTRUCTOR: + this.texts[i] = new RichTextStrikethrough(input); + break; + case RichTextFixed.CONSTRUCTOR: + this.texts[i] = new RichTextFixed(input); + break; + case RichTextUrl.CONSTRUCTOR: + this.texts[i] = new RichTextUrl(input); + break; + case RichTextEmailAddress.CONSTRUCTOR: + this.texts[i] = new RichTextEmailAddress(input); + break; + case RichTextSubscript.CONSTRUCTOR: + this.texts[i] = new RichTextSubscript(input); + break; + case RichTextSuperscript.CONSTRUCTOR: + this.texts[i] = new RichTextSuperscript(input); + break; + case RichTextMarked.CONSTRUCTOR: + this.texts[i] = new RichTextMarked(input); + break; + case RichTextPhoneNumber.CONSTRUCTOR: + this.texts[i] = new RichTextPhoneNumber(input); + break; + case RichTextIcon.CONSTRUCTOR: + this.texts[i] = new RichTextIcon(input); + break; + case RichTextReference.CONSTRUCTOR: + this.texts[i] = new RichTextReference(input); + break; + case RichTextAnchor.CONSTRUCTOR: + this.texts[i] = new RichTextAnchor(input); + break; + case RichTextAnchorLink.CONSTRUCTOR: + this.texts[i] = new RichTextAnchorLink(input); + break; + case RichTexts.CONSTRUCTOR: + this.texts[i] = new RichTexts(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.texts.length); + for (int i = 0; i < this.texts.length; i++) { + this.texts[i].serialize(output); + } + } } public static class SavedCredentials extends Object { public String id; public String title; - public SavedCredentials() { - } + public static final int CONSTRUCTOR = -370273060; + + public SavedCredentials() {} public SavedCredentials(String id, String title) { this.id = id; this.title = title; } - public static final int CONSTRUCTOR = -370273060; + public SavedCredentials(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class ScopeNotificationSettings extends Object { @@ -11263,8 +30651,9 @@ public class TdApi { public boolean disablePinnedMessageNotifications; public boolean disableMentionNotifications; - public ScopeNotificationSettings() { - } + public static final int CONSTRUCTOR = -426103745; + + public ScopeNotificationSettings() {} public ScopeNotificationSettings(int muteFor, String sound, boolean showPreview, boolean disablePinnedMessageNotifications, boolean disableMentionNotifications) { this.muteFor = muteFor; @@ -11274,241 +30663,350 @@ public class TdApi { this.disableMentionNotifications = disableMentionNotifications; } - public static final int CONSTRUCTOR = -426103745; + public ScopeNotificationSettings(DataInputStream input) throws IOException { + this.muteFor = input.readInt(); + if (input.readBoolean()) { + var soundTmp = new byte[input.readInt()]; + input.readFully(soundTmp); + this.sound = new String(soundTmp, StandardCharsets.UTF_8); + } + this.showPreview = input.readBoolean(); + this.disablePinnedMessageNotifications = input.readBoolean(); + this.disableMentionNotifications = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class SearchMessagesFilter extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.muteFor); + if (this.sound == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var soundTmp = this.sound.getBytes(StandardCharsets.UTF_8); + output.writeInt(soundTmp.length); + output.write(soundTmp); + } + output.writeBoolean(this.showPreview); + output.writeBoolean(this.disablePinnedMessageNotifications); + output.writeBoolean(this.disableMentionNotifications); + } } public static class SearchMessagesFilterEmpty extends SearchMessagesFilter { - - public SearchMessagesFilterEmpty() { - } - public static final int CONSTRUCTOR = -869395657; - @Override + public SearchMessagesFilterEmpty() {} + + + public SearchMessagesFilterEmpty(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterAnimation extends SearchMessagesFilter { - - public SearchMessagesFilterAnimation() { - } - public static final int CONSTRUCTOR = -155713339; - @Override + public SearchMessagesFilterAnimation() {} + + + public SearchMessagesFilterAnimation(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterAudio extends SearchMessagesFilter { - - public SearchMessagesFilterAudio() { - } - public static final int CONSTRUCTOR = 867505275; - @Override + public SearchMessagesFilterAudio() {} + + + public SearchMessagesFilterAudio(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterDocument extends SearchMessagesFilter { - - public SearchMessagesFilterDocument() { - } - public static final int CONSTRUCTOR = 1526331215; - @Override + public SearchMessagesFilterDocument() {} + + + public SearchMessagesFilterDocument(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterPhoto extends SearchMessagesFilter { - - public SearchMessagesFilterPhoto() { - } - public static final int CONSTRUCTOR = 925932293; - @Override + public SearchMessagesFilterPhoto() {} + + + public SearchMessagesFilterPhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterVideo extends SearchMessagesFilter { - - public SearchMessagesFilterVideo() { - } - public static final int CONSTRUCTOR = 115538222; - @Override + public SearchMessagesFilterVideo() {} + + + public SearchMessagesFilterVideo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterVoiceNote extends SearchMessagesFilter { - - public SearchMessagesFilterVoiceNote() { - } - public static final int CONSTRUCTOR = 1841439357; - @Override + public SearchMessagesFilterVoiceNote() {} + + + public SearchMessagesFilterVoiceNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterPhotoAndVideo extends SearchMessagesFilter { - - public SearchMessagesFilterPhotoAndVideo() { - } - public static final int CONSTRUCTOR = 1352130963; - @Override + public SearchMessagesFilterPhotoAndVideo() {} + + + public SearchMessagesFilterPhotoAndVideo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterUrl extends SearchMessagesFilter { - - public SearchMessagesFilterUrl() { - } - public static final int CONSTRUCTOR = -1828724341; - @Override + public SearchMessagesFilterUrl() {} + + + public SearchMessagesFilterUrl(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterChatPhoto extends SearchMessagesFilter { - - public SearchMessagesFilterChatPhoto() { - } - public static final int CONSTRUCTOR = -1247751329; - @Override + public SearchMessagesFilterChatPhoto() {} + + + public SearchMessagesFilterChatPhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterCall extends SearchMessagesFilter { - - public SearchMessagesFilterCall() { - } - public static final int CONSTRUCTOR = 1305231012; - @Override + public SearchMessagesFilterCall() {} + + + public SearchMessagesFilterCall(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterMissedCall extends SearchMessagesFilter { - - public SearchMessagesFilterMissedCall() { - } - public static final int CONSTRUCTOR = 970663098; - @Override + public SearchMessagesFilterMissedCall() {} + + + public SearchMessagesFilterMissedCall(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterVideoNote extends SearchMessagesFilter { - - public SearchMessagesFilterVideoNote() { - } - public static final int CONSTRUCTOR = 564323321; - @Override + public SearchMessagesFilterVideoNote() {} + + + public SearchMessagesFilterVideoNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterVoiceAndVideoNote extends SearchMessagesFilter { - - public SearchMessagesFilterVoiceAndVideoNote() { - } - public static final int CONSTRUCTOR = 664174819; - @Override + public SearchMessagesFilterVoiceAndVideoNote() {} + + + public SearchMessagesFilterVoiceAndVideoNote(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterMention extends SearchMessagesFilter { - - public SearchMessagesFilterMention() { - } - public static final int CONSTRUCTOR = 2001258652; - @Override + public SearchMessagesFilterMention() {} + + + public SearchMessagesFilterMention(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SearchMessagesFilterUnreadMention extends SearchMessagesFilter { - - public SearchMessagesFilterUnreadMention() { - } - public static final int CONSTRUCTOR = -95769149; - @Override + public SearchMessagesFilterUnreadMention() {} + + + public SearchMessagesFilterUnreadMention(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class Seconds extends Object { public double seconds; - public Seconds() { - } + public static final int CONSTRUCTOR = 959899022; + + public Seconds() {} public Seconds(double seconds) { this.seconds = seconds; } - public static final int CONSTRUCTOR = 959899022; + public Seconds(DataInputStream input) throws IOException { + this.seconds = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeDouble(this.seconds); + } } public static class SecretChat extends Object { @@ -11520,8 +31018,9 @@ public class TdApi { public byte[] keyHash; public int layer; - public SecretChat() { - } + public static final int CONSTRUCTOR = 1279231629; + + public SecretChat() {} public SecretChat(int id, int userId, SecretChatState state, boolean isOutbound, int ttl, byte[] keyHash, int layer) { this.id = id; @@ -11533,54 +31032,105 @@ public class TdApi { this.layer = layer; } - public static final int CONSTRUCTOR = 1279231629; + public SecretChat(DataInputStream input) throws IOException { + this.id = input.readInt(); + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case SecretChatStatePending.CONSTRUCTOR: + this.state = new SecretChatStatePending(input); + break; + case SecretChatStateReady.CONSTRUCTOR: + this.state = new SecretChatStateReady(input); + break; + case SecretChatStateClosed.CONSTRUCTOR: + this.state = new SecretChatStateClosed(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.isOutbound = input.readBoolean(); + this.ttl = input.readInt(); + this.keyHash = new byte[input.readInt()]; + input.readFully(this.keyHash); + this.layer = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class SecretChatState extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + output.writeInt(this.userId); + if (this.state == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.state.serialize(output); + } + output.writeBoolean(this.isOutbound); + output.writeInt(this.ttl); + output.writeInt(this.keyHash.length); + output.write(this.keyHash); + output.writeInt(this.layer); + } } public static class SecretChatStatePending extends SecretChatState { - - public SecretChatStatePending() { - } - public static final int CONSTRUCTOR = -1637050756; - @Override + public SecretChatStatePending() {} + + + public SecretChatStatePending(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SecretChatStateReady extends SecretChatState { - - public SecretChatStateReady() { - } - public static final int CONSTRUCTOR = -1611352087; - @Override + public SecretChatStateReady() {} + + + public SecretChatStateReady(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SecretChatStateClosed extends SecretChatState { - - public SecretChatStateClosed() { - } - public static final int CONSTRUCTOR = -1945106707; - @Override + public SecretChatStateClosed() {} + + + public SecretChatStateClosed(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SendMessageOptions extends Object { @@ -11588,8 +31138,9 @@ public class TdApi { public boolean fromBackground; public MessageSchedulingState schedulingState; - public SendMessageOptions() { - } + public static final int CONSTRUCTOR = 669760254; + + public SendMessageOptions() {} public SendMessageOptions(boolean disableNotification, boolean fromBackground, MessageSchedulingState schedulingState) { this.disableNotification = disableNotification; @@ -11597,12 +31148,38 @@ public class TdApi { this.schedulingState = schedulingState; } - public static final int CONSTRUCTOR = 669760254; + public SendMessageOptions(DataInputStream input) throws IOException { + this.disableNotification = input.readBoolean(); + this.fromBackground = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageSchedulingStateSendAtDate.CONSTRUCTOR: + this.schedulingState = new MessageSchedulingStateSendAtDate(input); + break; + case MessageSchedulingStateSendWhenOnline.CONSTRUCTOR: + this.schedulingState = new MessageSchedulingStateSendWhenOnline(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.disableNotification); + output.writeBoolean(this.fromBackground); + if (this.schedulingState == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.schedulingState.serialize(output); + } + } } public static class Session extends Object { @@ -11622,8 +31199,9 @@ public class TdApi { public String country; public String region; - public Session() { - } + public static final int CONSTRUCTOR = 1920553176; + + public Session() {} public Session(long id, boolean isCurrent, boolean isPasswordPending, int apiId, String applicationName, String applicationVersion, boolean isOfficialApplication, String deviceModel, String platform, String systemVersion, int logInDate, int lastActiveDate, String ip, String country, String region) { this.id = id; @@ -11643,30 +31221,168 @@ public class TdApi { this.region = region; } - public static final int CONSTRUCTOR = 1920553176; + public Session(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.isCurrent = input.readBoolean(); + this.isPasswordPending = input.readBoolean(); + this.apiId = input.readInt(); + if (input.readBoolean()) { + var applicationNameTmp = new byte[input.readInt()]; + input.readFully(applicationNameTmp); + this.applicationName = new String(applicationNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var applicationVersionTmp = new byte[input.readInt()]; + input.readFully(applicationVersionTmp); + this.applicationVersion = new String(applicationVersionTmp, StandardCharsets.UTF_8); + } + this.isOfficialApplication = input.readBoolean(); + if (input.readBoolean()) { + var deviceModelTmp = new byte[input.readInt()]; + input.readFully(deviceModelTmp); + this.deviceModel = new String(deviceModelTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var platformTmp = new byte[input.readInt()]; + input.readFully(platformTmp); + this.platform = new String(platformTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var systemVersionTmp = new byte[input.readInt()]; + input.readFully(systemVersionTmp); + this.systemVersion = new String(systemVersionTmp, StandardCharsets.UTF_8); + } + this.logInDate = input.readInt(); + this.lastActiveDate = input.readInt(); + if (input.readBoolean()) { + var ipTmp = new byte[input.readInt()]; + input.readFully(ipTmp); + this.ip = new String(ipTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var countryTmp = new byte[input.readInt()]; + input.readFully(countryTmp); + this.country = new String(countryTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var regionTmp = new byte[input.readInt()]; + input.readFully(regionTmp); + this.region = new String(regionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeBoolean(this.isCurrent); + output.writeBoolean(this.isPasswordPending); + output.writeInt(this.apiId); + if (this.applicationName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var applicationNameTmp = this.applicationName.getBytes(StandardCharsets.UTF_8); + output.writeInt(applicationNameTmp.length); + output.write(applicationNameTmp); + } + if (this.applicationVersion == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var applicationVersionTmp = this.applicationVersion.getBytes(StandardCharsets.UTF_8); + output.writeInt(applicationVersionTmp.length); + output.write(applicationVersionTmp); + } + output.writeBoolean(this.isOfficialApplication); + if (this.deviceModel == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var deviceModelTmp = this.deviceModel.getBytes(StandardCharsets.UTF_8); + output.writeInt(deviceModelTmp.length); + output.write(deviceModelTmp); + } + if (this.platform == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var platformTmp = this.platform.getBytes(StandardCharsets.UTF_8); + output.writeInt(platformTmp.length); + output.write(platformTmp); + } + if (this.systemVersion == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var systemVersionTmp = this.systemVersion.getBytes(StandardCharsets.UTF_8); + output.writeInt(systemVersionTmp.length); + output.write(systemVersionTmp); + } + output.writeInt(this.logInDate); + output.writeInt(this.lastActiveDate); + if (this.ip == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var ipTmp = this.ip.getBytes(StandardCharsets.UTF_8); + output.writeInt(ipTmp.length); + output.write(ipTmp); + } + if (this.country == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var countryTmp = this.country.getBytes(StandardCharsets.UTF_8); + output.writeInt(countryTmp.length); + output.write(countryTmp); + } + if (this.region == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var regionTmp = this.region.getBytes(StandardCharsets.UTF_8); + output.writeInt(regionTmp.length); + output.write(regionTmp); + } + } } public static class Sessions extends Object { public Session[] sessions; - public Sessions() { - } + public static final int CONSTRUCTOR = -463118121; + + public Sessions() {} public Sessions(Session[] sessions) { this.sessions = sessions; } - public static final int CONSTRUCTOR = -463118121; + public Sessions(DataInputStream input) throws IOException { + this.sessions = new Session[input.readInt()]; + for (int i = 0; i < this.sessions.length; i++) { + if (Session.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sessions[i] = new Session(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.sessions.length); + for (int i = 0; i < this.sessions.length; i++) { + this.sessions[i].serialize(output); + } + } } public static class ShippingOption extends Object { @@ -11674,8 +31390,9 @@ public class TdApi { public String title; public LabeledPricePart[] priceParts; - public ShippingOption() { - } + public static final int CONSTRUCTOR = 1425690001; + + public ShippingOption() {} public ShippingOption(String id, String title, LabeledPricePart[] priceParts) { this.id = id; @@ -11683,71 +31400,176 @@ public class TdApi { this.priceParts = priceParts; } - public static final int CONSTRUCTOR = 1425690001; + public ShippingOption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.priceParts = new LabeledPricePart[input.readInt()]; + for (int i = 0; i < this.priceParts.length; i++) { + if (LabeledPricePart.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.priceParts[i] = new LabeledPricePart(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class StatisticsGraph extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeInt(this.priceParts.length); + for (int i = 0; i < this.priceParts.length; i++) { + this.priceParts[i].serialize(output); + } + } } public static class StatisticsGraphData extends StatisticsGraph { public String jsonData; public String zoomToken; - public StatisticsGraphData() { - } + public static final int CONSTRUCTOR = -1756117226; + + public StatisticsGraphData() {} public StatisticsGraphData(String jsonData, String zoomToken) { this.jsonData = jsonData; this.zoomToken = zoomToken; } - public static final int CONSTRUCTOR = -1756117226; + public StatisticsGraphData(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var jsonDataTmp = new byte[input.readInt()]; + input.readFully(jsonDataTmp); + this.jsonData = new String(jsonDataTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var zoomTokenTmp = new byte[input.readInt()]; + input.readFully(zoomTokenTmp); + this.zoomToken = new String(zoomTokenTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.jsonData == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var jsonDataTmp = this.jsonData.getBytes(StandardCharsets.UTF_8); + output.writeInt(jsonDataTmp.length); + output.write(jsonDataTmp); + } + if (this.zoomToken == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var zoomTokenTmp = this.zoomToken.getBytes(StandardCharsets.UTF_8); + output.writeInt(zoomTokenTmp.length); + output.write(zoomTokenTmp); + } + } } public static class StatisticsGraphAsync extends StatisticsGraph { public String token; - public StatisticsGraphAsync() { - } + public static final int CONSTRUCTOR = 1064479337; + + public StatisticsGraphAsync() {} public StatisticsGraphAsync(String token) { this.token = token; } - public static final int CONSTRUCTOR = 1064479337; + public StatisticsGraphAsync(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tokenTmp = new byte[input.readInt()]; + input.readFully(tokenTmp); + this.token = new String(tokenTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.token == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tokenTmp = this.token.getBytes(StandardCharsets.UTF_8); + output.writeInt(tokenTmp.length); + output.write(tokenTmp); + } + } } public static class StatisticsGraphError extends StatisticsGraph { public String errorMessage; - public StatisticsGraphError() { - } + public static final int CONSTRUCTOR = -61804431; + + public StatisticsGraphError() {} public StatisticsGraphError(String errorMessage) { this.errorMessage = errorMessage; } - public static final int CONSTRUCTOR = -61804431; + public StatisticsGraphError(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var errorMessageTmp = new byte[input.readInt()]; + input.readFully(errorMessageTmp); + this.errorMessage = new String(errorMessageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.errorMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var errorMessageTmp = this.errorMessage.getBytes(StandardCharsets.UTF_8); + output.writeInt(errorMessageTmp.length); + output.write(errorMessageTmp); + } + } } public static class StatisticsValue extends Object { @@ -11755,8 +31577,9 @@ public class TdApi { public double previousValue; public double growthRatePercentage; - public StatisticsValue() { - } + public static final int CONSTRUCTOR = 1147508964; + + public StatisticsValue() {} public StatisticsValue(double value, double previousValue, double growthRatePercentage) { this.value = value; @@ -11764,12 +31587,22 @@ public class TdApi { this.growthRatePercentage = growthRatePercentage; } - public static final int CONSTRUCTOR = 1147508964; + public StatisticsValue(DataInputStream input) throws IOException { + this.value = input.readDouble(); + this.previousValue = input.readDouble(); + this.growthRatePercentage = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeDouble(this.value); + output.writeDouble(this.previousValue); + output.writeDouble(this.growthRatePercentage); + } } public static class Sticker extends Object { @@ -11783,8 +31616,9 @@ public class TdApi { public PhotoSize thumbnail; public File sticker; - public Sticker() { - } + public static final int CONSTRUCTOR = -1835470627; + + public Sticker() {} public Sticker(long setId, int width, int height, String emoji, boolean isAnimated, boolean isMask, MaskPosition maskPosition, PhotoSize thumbnail, File sticker) { this.setId = setId; @@ -11798,12 +31632,75 @@ public class TdApi { this.sticker = sticker; } - public static final int CONSTRUCTOR = -1835470627; + public Sticker(DataInputStream input) throws IOException { + this.setId = input.readLong(); + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + var emojiTmp = new byte[input.readInt()]; + input.readFully(emojiTmp); + this.emoji = new String(emojiTmp, StandardCharsets.UTF_8); + } + this.isAnimated = input.readBoolean(); + this.isMask = input.readBoolean(); + if (input.readBoolean()) { + if (MaskPosition.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.maskPosition = new MaskPosition(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sticker = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.setId); + output.writeInt(this.width); + output.writeInt(this.height); + if (this.emoji == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojiTmp = this.emoji.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojiTmp.length); + output.write(emojiTmp); + } + output.writeBoolean(this.isAnimated); + output.writeBoolean(this.isMask); + if (this.maskPosition == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.maskPosition.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class StickerSet extends Object { @@ -11820,8 +31717,9 @@ public class TdApi { public Sticker[] stickers; public Emojis[] emojis; - public StickerSet() { - } + public static final int CONSTRUCTOR = 734588298; + + public StickerSet() {} public StickerSet(long id, String title, String name, PhotoSize thumbnail, boolean isInstalled, boolean isArchived, boolean isOfficial, boolean isAnimated, boolean isMasks, boolean isViewed, Sticker[] stickers, Emojis[] emojis) { this.id = id; @@ -11838,12 +31736,90 @@ public class TdApi { this.emojis = emojis; } - public static final int CONSTRUCTOR = 734588298; + public StickerSet(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + this.isInstalled = input.readBoolean(); + this.isArchived = input.readBoolean(); + this.isOfficial = input.readBoolean(); + this.isAnimated = input.readBoolean(); + this.isMasks = input.readBoolean(); + this.isViewed = input.readBoolean(); + this.stickers = new Sticker[input.readInt()]; + for (int i = 0; i < this.stickers.length; i++) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.stickers[i] = new Sticker(input); + } + this.emojis = new Emojis[input.readInt()]; + for (int i = 0; i < this.emojis.length; i++) { + if (Emojis.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.emojis[i] = new Emojis(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeBoolean(this.isInstalled); + output.writeBoolean(this.isArchived); + output.writeBoolean(this.isOfficial); + output.writeBoolean(this.isAnimated); + output.writeBoolean(this.isMasks); + output.writeBoolean(this.isViewed); + output.writeInt(this.stickers.length); + for (int i = 0; i < this.stickers.length; i++) { + this.stickers[i].serialize(output); + } + output.writeInt(this.emojis.length); + for (int i = 0; i < this.emojis.length; i++) { + this.emojis[i].serialize(output); + } + } } public static class StickerSetInfo extends Object { @@ -11860,8 +31836,9 @@ public class TdApi { public int size; public Sticker[] covers; - public StickerSetInfo() { - } + public static final int CONSTRUCTOR = 228054782; + + public StickerSetInfo() {} public StickerSetInfo(long id, String title, String name, PhotoSize thumbnail, boolean isInstalled, boolean isArchived, boolean isOfficial, boolean isAnimated, boolean isMasks, boolean isViewed, int size, Sticker[] covers) { this.id = id; @@ -11878,50 +31855,153 @@ public class TdApi { this.covers = covers; } - public static final int CONSTRUCTOR = 228054782; + public StickerSetInfo(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + this.isInstalled = input.readBoolean(); + this.isArchived = input.readBoolean(); + this.isOfficial = input.readBoolean(); + this.isAnimated = input.readBoolean(); + this.isMasks = input.readBoolean(); + this.isViewed = input.readBoolean(); + this.size = input.readInt(); + this.covers = new Sticker[input.readInt()]; + for (int i = 0; i < this.covers.length; i++) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.covers[i] = new Sticker(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + output.writeBoolean(this.isInstalled); + output.writeBoolean(this.isArchived); + output.writeBoolean(this.isOfficial); + output.writeBoolean(this.isAnimated); + output.writeBoolean(this.isMasks); + output.writeBoolean(this.isViewed); + output.writeInt(this.size); + output.writeInt(this.covers.length); + for (int i = 0; i < this.covers.length; i++) { + this.covers[i].serialize(output); + } + } } public static class StickerSets extends Object { public int totalCount; public StickerSetInfo[] sets; - public StickerSets() { - } + public static final int CONSTRUCTOR = -1883828812; + + public StickerSets() {} public StickerSets(int totalCount, StickerSetInfo[] sets) { this.totalCount = totalCount; this.sets = sets; } - public static final int CONSTRUCTOR = -1883828812; + public StickerSets(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + this.sets = new StickerSetInfo[input.readInt()]; + for (int i = 0; i < this.sets.length; i++) { + if (StickerSetInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sets[i] = new StickerSetInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + output.writeInt(this.sets.length); + for (int i = 0; i < this.sets.length; i++) { + this.sets[i].serialize(output); + } + } } public static class Stickers extends Object { public Sticker[] stickers; - public Stickers() { - } + public static final int CONSTRUCTOR = 1974859260; + + public Stickers() {} public Stickers(Sticker[] stickers) { this.stickers = stickers; } - public static final int CONSTRUCTOR = 1974859260; + public Stickers(DataInputStream input) throws IOException { + this.stickers = new Sticker[input.readInt()]; + for (int i = 0; i < this.stickers.length; i++) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.stickers[i] = new Sticker(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.stickers.length); + for (int i = 0; i < this.stickers.length; i++) { + this.stickers[i].serialize(output); + } + } } public static class StorageStatistics extends Object { @@ -11929,8 +32009,9 @@ public class TdApi { public int count; public StorageStatisticsByChat[] byChat; - public StorageStatistics() { - } + public static final int CONSTRUCTOR = 217237013; + + public StorageStatistics() {} public StorageStatistics(long size, int count, StorageStatisticsByChat[] byChat) { this.size = size; @@ -11938,12 +32019,31 @@ public class TdApi { this.byChat = byChat; } - public static final int CONSTRUCTOR = 217237013; + public StorageStatistics(DataInputStream input) throws IOException { + this.size = input.readLong(); + this.count = input.readInt(); + this.byChat = new StorageStatisticsByChat[input.readInt()]; + for (int i = 0; i < this.byChat.length; i++) { + if (StorageStatisticsByChat.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.byChat[i] = new StorageStatisticsByChat(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.size); + output.writeInt(this.count); + output.writeInt(this.byChat.length); + for (int i = 0; i < this.byChat.length; i++) { + this.byChat[i].serialize(output); + } + } } public static class StorageStatisticsByChat extends Object { @@ -11952,8 +32052,9 @@ public class TdApi { public int count; public StorageStatisticsByFileType[] byFileType; - public StorageStatisticsByChat() { - } + public static final int CONSTRUCTOR = 635434531; + + public StorageStatisticsByChat() {} public StorageStatisticsByChat(long chatId, long size, int count, StorageStatisticsByFileType[] byFileType) { this.chatId = chatId; @@ -11962,12 +32063,33 @@ public class TdApi { this.byFileType = byFileType; } - public static final int CONSTRUCTOR = 635434531; + public StorageStatisticsByChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.size = input.readLong(); + this.count = input.readInt(); + this.byFileType = new StorageStatisticsByFileType[input.readInt()]; + for (int i = 0; i < this.byFileType.length; i++) { + if (StorageStatisticsByFileType.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.byFileType[i] = new StorageStatisticsByFileType(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.size); + output.writeInt(this.count); + output.writeInt(this.byFileType.length); + for (int i = 0; i < this.byFileType.length; i++) { + this.byFileType[i].serialize(output); + } + } } public static class StorageStatisticsByFileType extends Object { @@ -11975,8 +32097,9 @@ public class TdApi { public long size; public int count; - public StorageStatisticsByFileType() { - } + public static final int CONSTRUCTOR = 714012840; + + public StorageStatisticsByFileType() {} public StorageStatisticsByFileType(FileType fileType, long size, int count) { this.fileType = fileType; @@ -11984,12 +32107,80 @@ public class TdApi { this.count = count; } - public static final int CONSTRUCTOR = 714012840; + public StorageStatisticsByFileType(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case FileTypeNone.CONSTRUCTOR: + this.fileType = new FileTypeNone(input); + break; + case FileTypeAnimation.CONSTRUCTOR: + this.fileType = new FileTypeAnimation(input); + break; + case FileTypeAudio.CONSTRUCTOR: + this.fileType = new FileTypeAudio(input); + break; + case FileTypeDocument.CONSTRUCTOR: + this.fileType = new FileTypeDocument(input); + break; + case FileTypePhoto.CONSTRUCTOR: + this.fileType = new FileTypePhoto(input); + break; + case FileTypeProfilePhoto.CONSTRUCTOR: + this.fileType = new FileTypeProfilePhoto(input); + break; + case FileTypeSecret.CONSTRUCTOR: + this.fileType = new FileTypeSecret(input); + break; + case FileTypeSecretThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeSecretThumbnail(input); + break; + case FileTypeSecure.CONSTRUCTOR: + this.fileType = new FileTypeSecure(input); + break; + case FileTypeSticker.CONSTRUCTOR: + this.fileType = new FileTypeSticker(input); + break; + case FileTypeThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeThumbnail(input); + break; + case FileTypeUnknown.CONSTRUCTOR: + this.fileType = new FileTypeUnknown(input); + break; + case FileTypeVideo.CONSTRUCTOR: + this.fileType = new FileTypeVideo(input); + break; + case FileTypeVideoNote.CONSTRUCTOR: + this.fileType = new FileTypeVideoNote(input); + break; + case FileTypeVoiceNote.CONSTRUCTOR: + this.fileType = new FileTypeVoiceNote(input); + break; + case FileTypeWallpaper.CONSTRUCTOR: + this.fileType = new FileTypeWallpaper(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.size = input.readLong(); + this.count = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fileType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.fileType.serialize(output); + } + output.writeLong(this.size); + output.writeInt(this.count); + } } public static class StorageStatisticsFast extends Object { @@ -11999,8 +32190,9 @@ public class TdApi { public long languagePackDatabaseSize; public long logSize; - public StorageStatisticsFast() { - } + public static final int CONSTRUCTOR = -884922271; + + public StorageStatisticsFast() {} public StorageStatisticsFast(long filesSize, int fileCount, long databaseSize, long languagePackDatabaseSize, long logSize) { this.filesSize = filesSize; @@ -12010,12 +32202,26 @@ public class TdApi { this.logSize = logSize; } - public static final int CONSTRUCTOR = -884922271; + public StorageStatisticsFast(DataInputStream input) throws IOException { + this.filesSize = input.readLong(); + this.fileCount = input.readInt(); + this.databaseSize = input.readLong(); + this.languagePackDatabaseSize = input.readLong(); + this.logSize = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.filesSize); + output.writeInt(this.fileCount); + output.writeLong(this.databaseSize); + output.writeLong(this.languagePackDatabaseSize); + output.writeLong(this.logSize); + } } public static class Supergroup extends Object { @@ -12033,8 +32239,9 @@ public class TdApi { public String restrictionReason; public boolean isScam; - public Supergroup() { - } + public static final int CONSTRUCTOR = -103091; + + public Supergroup() {} public Supergroup(int id, String username, int date, ChatMemberStatus status, int memberCount, boolean hasLinkedChat, boolean hasLocation, boolean signMessages, boolean isSlowModeEnabled, boolean isChannel, boolean isVerified, String restrictionReason, boolean isScam) { this.id = id; @@ -12052,12 +32259,92 @@ public class TdApi { this.isScam = isScam; } - public static final int CONSTRUCTOR = -103091; + public Supergroup(DataInputStream input) throws IOException { + this.id = input.readInt(); + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + this.date = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.status = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.status = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.status = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.status = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.status = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.status = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.memberCount = input.readInt(); + this.hasLinkedChat = input.readBoolean(); + this.hasLocation = input.readBoolean(); + this.signMessages = input.readBoolean(); + this.isSlowModeEnabled = input.readBoolean(); + this.isChannel = input.readBoolean(); + this.isVerified = input.readBoolean(); + if (input.readBoolean()) { + var restrictionReasonTmp = new byte[input.readInt()]; + input.readFully(restrictionReasonTmp); + this.restrictionReason = new String(restrictionReasonTmp, StandardCharsets.UTF_8); + } + this.isScam = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + output.writeInt(this.date); + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + output.writeInt(this.memberCount); + output.writeBoolean(this.hasLinkedChat); + output.writeBoolean(this.hasLocation); + output.writeBoolean(this.signMessages); + output.writeBoolean(this.isSlowModeEnabled); + output.writeBoolean(this.isChannel); + output.writeBoolean(this.isVerified); + if (this.restrictionReason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var restrictionReasonTmp = this.restrictionReason.getBytes(StandardCharsets.UTF_8); + output.writeInt(restrictionReasonTmp.length); + output.write(restrictionReasonTmp); + } + output.writeBoolean(this.isScam); + } } public static class SupergroupFullInfo extends Object { @@ -12081,8 +32368,9 @@ public class TdApi { public int upgradedFromBasicGroupId; public long upgradedFromMaxMessageId; - public SupergroupFullInfo() { - } + public static final int CONSTRUCTOR = -1562832718; + + public SupergroupFullInfo() {} public SupergroupFullInfo(String description, int memberCount, int administratorCount, int restrictedCount, int bannedCount, long linkedChatId, int slowModeDelay, double slowModeDelayExpiresIn, boolean canGetMembers, boolean canSetUsername, boolean canSetStickerSet, boolean canSetLocation, boolean canViewStatistics, boolean isAllHistoryAvailable, long stickerSetId, ChatLocation location, String inviteLink, int upgradedFromBasicGroupId, long upgradedFromMaxMessageId) { this.description = description; @@ -12106,239 +32394,490 @@ public class TdApi { this.upgradedFromMaxMessageId = upgradedFromMaxMessageId; } - public static final int CONSTRUCTOR = -1562832718; + public SupergroupFullInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + this.memberCount = input.readInt(); + this.administratorCount = input.readInt(); + this.restrictedCount = input.readInt(); + this.bannedCount = input.readInt(); + this.linkedChatId = input.readLong(); + this.slowModeDelay = input.readInt(); + this.slowModeDelayExpiresIn = input.readDouble(); + this.canGetMembers = input.readBoolean(); + this.canSetUsername = input.readBoolean(); + this.canSetStickerSet = input.readBoolean(); + this.canSetLocation = input.readBoolean(); + this.canViewStatistics = input.readBoolean(); + this.isAllHistoryAvailable = input.readBoolean(); + this.stickerSetId = input.readLong(); + if (input.readBoolean()) { + if (ChatLocation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new ChatLocation(input); + } + if (input.readBoolean()) { + var inviteLinkTmp = new byte[input.readInt()]; + input.readFully(inviteLinkTmp); + this.inviteLink = new String(inviteLinkTmp, StandardCharsets.UTF_8); + } + this.upgradedFromBasicGroupId = input.readInt(); + this.upgradedFromMaxMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class SupergroupMembersFilter extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + output.writeInt(this.memberCount); + output.writeInt(this.administratorCount); + output.writeInt(this.restrictedCount); + output.writeInt(this.bannedCount); + output.writeLong(this.linkedChatId); + output.writeInt(this.slowModeDelay); + output.writeDouble(this.slowModeDelayExpiresIn); + output.writeBoolean(this.canGetMembers); + output.writeBoolean(this.canSetUsername); + output.writeBoolean(this.canSetStickerSet); + output.writeBoolean(this.canSetLocation); + output.writeBoolean(this.canViewStatistics); + output.writeBoolean(this.isAllHistoryAvailable); + output.writeLong(this.stickerSetId); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + if (this.inviteLink == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inviteLinkTmp = this.inviteLink.getBytes(StandardCharsets.UTF_8); + output.writeInt(inviteLinkTmp.length); + output.write(inviteLinkTmp); + } + output.writeInt(this.upgradedFromBasicGroupId); + output.writeLong(this.upgradedFromMaxMessageId); + } } public static class SupergroupMembersFilterRecent extends SupergroupMembersFilter { - - public SupergroupMembersFilterRecent() { - } - public static final int CONSTRUCTOR = 1178199509; - @Override + public SupergroupMembersFilterRecent() {} + + + public SupergroupMembersFilterRecent(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SupergroupMembersFilterContacts extends SupergroupMembersFilter { public String query; - public SupergroupMembersFilterContacts() { - } + public static final int CONSTRUCTOR = -1282910856; + + public SupergroupMembersFilterContacts() {} public SupergroupMembersFilterContacts(String query) { this.query = query; } - public static final int CONSTRUCTOR = -1282910856; + public SupergroupMembersFilterContacts(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + } } public static class SupergroupMembersFilterAdministrators extends SupergroupMembersFilter { - - public SupergroupMembersFilterAdministrators() { - } - public static final int CONSTRUCTOR = -2097380265; - @Override + public SupergroupMembersFilterAdministrators() {} + + + public SupergroupMembersFilterAdministrators(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SupergroupMembersFilterSearch extends SupergroupMembersFilter { public String query; - public SupergroupMembersFilterSearch() { - } + public static final int CONSTRUCTOR = -1696358469; + + public SupergroupMembersFilterSearch() {} public SupergroupMembersFilterSearch(String query) { this.query = query; } - public static final int CONSTRUCTOR = -1696358469; + public SupergroupMembersFilterSearch(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + } } public static class SupergroupMembersFilterRestricted extends SupergroupMembersFilter { public String query; - public SupergroupMembersFilterRestricted() { - } + public static final int CONSTRUCTOR = -1107800034; + + public SupergroupMembersFilterRestricted() {} public SupergroupMembersFilterRestricted(String query) { this.query = query; } - public static final int CONSTRUCTOR = -1107800034; + public SupergroupMembersFilterRestricted(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + } } public static class SupergroupMembersFilterBanned extends SupergroupMembersFilter { public String query; - public SupergroupMembersFilterBanned() { - } + public static final int CONSTRUCTOR = -1210621683; + + public SupergroupMembersFilterBanned() {} public SupergroupMembersFilterBanned(String query) { this.query = query; } - public static final int CONSTRUCTOR = -1210621683; + public SupergroupMembersFilterBanned(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + } } public static class SupergroupMembersFilterBots extends SupergroupMembersFilter { - - public SupergroupMembersFilterBots() { - } - public static final int CONSTRUCTOR = 492138918; - @Override + public SupergroupMembersFilterBots() {} + + + public SupergroupMembersFilterBots(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TMeUrl extends Object { public String url; public TMeUrlType type; - public TMeUrl() { - } + public static final int CONSTRUCTOR = -1140786622; + + public TMeUrl() {} public TMeUrl(String url, TMeUrlType type) { this.url = url; this.type = type; } - public static final int CONSTRUCTOR = -1140786622; + public TMeUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case TMeUrlTypeUser.CONSTRUCTOR: + this.type = new TMeUrlTypeUser(input); + break; + case TMeUrlTypeSupergroup.CONSTRUCTOR: + this.type = new TMeUrlTypeSupergroup(input); + break; + case TMeUrlTypeChatInvite.CONSTRUCTOR: + this.type = new TMeUrlTypeChatInvite(input); + break; + case TMeUrlTypeStickerSet.CONSTRUCTOR: + this.type = new TMeUrlTypeStickerSet(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class TMeUrlType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class TMeUrlTypeUser extends TMeUrlType { public int userId; - public TMeUrlTypeUser() { - } + public static final int CONSTRUCTOR = -1198700130; + + public TMeUrlTypeUser() {} public TMeUrlTypeUser(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -1198700130; + public TMeUrlTypeUser(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class TMeUrlTypeSupergroup extends TMeUrlType { public long supergroupId; - public TMeUrlTypeSupergroup() { - } + public static final int CONSTRUCTOR = -1353369944; + + public TMeUrlTypeSupergroup() {} public TMeUrlTypeSupergroup(long supergroupId) { this.supergroupId = supergroupId; } - public static final int CONSTRUCTOR = -1353369944; + public TMeUrlTypeSupergroup(DataInputStream input) throws IOException { + this.supergroupId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.supergroupId); + } } public static class TMeUrlTypeChatInvite extends TMeUrlType { public ChatInviteLinkInfo info; - public TMeUrlTypeChatInvite() { - } + public static final int CONSTRUCTOR = 313907785; + + public TMeUrlTypeChatInvite() {} public TMeUrlTypeChatInvite(ChatInviteLinkInfo info) { this.info = info; } - public static final int CONSTRUCTOR = 313907785; + public TMeUrlTypeChatInvite(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (ChatInviteLinkInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.info = new ChatInviteLinkInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.info == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.info.serialize(output); + } + } } public static class TMeUrlTypeStickerSet extends TMeUrlType { public long stickerSetId; - public TMeUrlTypeStickerSet() { - } + public static final int CONSTRUCTOR = 1602473196; + + public TMeUrlTypeStickerSet() {} public TMeUrlTypeStickerSet(long stickerSetId) { this.stickerSetId = stickerSetId; } - public static final int CONSTRUCTOR = 1602473196; + public TMeUrlTypeStickerSet(DataInputStream input) throws IOException { + this.stickerSetId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.stickerSetId); + } } public static class TMeUrls extends Object { public TMeUrl[] urls; - public TMeUrls() { - } + public static final int CONSTRUCTOR = -1130595098; + + public TMeUrls() {} public TMeUrls(TMeUrl[] urls) { this.urls = urls; } - public static final int CONSTRUCTOR = -1130595098; + public TMeUrls(DataInputStream input) throws IOException { + this.urls = new TMeUrl[input.readInt()]; + for (int i = 0; i < this.urls.length; i++) { + if (TMeUrl.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.urls[i] = new TMeUrl(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.urls.length); + for (int i = 0; i < this.urls.length; i++) { + this.urls[i].serialize(output); + } + } } public static class TdlibParameters extends Object { @@ -12358,8 +32897,9 @@ public class TdApi { public boolean enableStorageOptimizer; public boolean ignoreFileNames; - public TdlibParameters() { - } + public static final int CONSTRUCTOR = -761520773; + + public TdlibParameters() {} public TdlibParameters(boolean useTestDc, String databaseDirectory, String filesDirectory, boolean useFileDatabase, boolean useChatInfoDatabase, boolean useMessageDatabase, boolean useSecretChats, int apiId, String apiHash, String systemLanguageCode, String deviceModel, String systemVersion, String applicationVersion, boolean enableStorageOptimizer, boolean ignoreFileNames) { this.useTestDc = useTestDc; @@ -12379,32 +32919,152 @@ public class TdApi { this.ignoreFileNames = ignoreFileNames; } - public static final int CONSTRUCTOR = -761520773; + public TdlibParameters(DataInputStream input) throws IOException { + this.useTestDc = input.readBoolean(); + if (input.readBoolean()) { + var databaseDirectoryTmp = new byte[input.readInt()]; + input.readFully(databaseDirectoryTmp); + this.databaseDirectory = new String(databaseDirectoryTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var filesDirectoryTmp = new byte[input.readInt()]; + input.readFully(filesDirectoryTmp); + this.filesDirectory = new String(filesDirectoryTmp, StandardCharsets.UTF_8); + } + this.useFileDatabase = input.readBoolean(); + this.useChatInfoDatabase = input.readBoolean(); + this.useMessageDatabase = input.readBoolean(); + this.useSecretChats = input.readBoolean(); + this.apiId = input.readInt(); + if (input.readBoolean()) { + var apiHashTmp = new byte[input.readInt()]; + input.readFully(apiHashTmp); + this.apiHash = new String(apiHashTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var systemLanguageCodeTmp = new byte[input.readInt()]; + input.readFully(systemLanguageCodeTmp); + this.systemLanguageCode = new String(systemLanguageCodeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var deviceModelTmp = new byte[input.readInt()]; + input.readFully(deviceModelTmp); + this.deviceModel = new String(deviceModelTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var systemVersionTmp = new byte[input.readInt()]; + input.readFully(systemVersionTmp); + this.systemVersion = new String(systemVersionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var applicationVersionTmp = new byte[input.readInt()]; + input.readFully(applicationVersionTmp); + this.applicationVersion = new String(applicationVersionTmp, StandardCharsets.UTF_8); + } + this.enableStorageOptimizer = input.readBoolean(); + this.ignoreFileNames = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.useTestDc); + if (this.databaseDirectory == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var databaseDirectoryTmp = this.databaseDirectory.getBytes(StandardCharsets.UTF_8); + output.writeInt(databaseDirectoryTmp.length); + output.write(databaseDirectoryTmp); + } + if (this.filesDirectory == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var filesDirectoryTmp = this.filesDirectory.getBytes(StandardCharsets.UTF_8); + output.writeInt(filesDirectoryTmp.length); + output.write(filesDirectoryTmp); + } + output.writeBoolean(this.useFileDatabase); + output.writeBoolean(this.useChatInfoDatabase); + output.writeBoolean(this.useMessageDatabase); + output.writeBoolean(this.useSecretChats); + output.writeInt(this.apiId); + if (this.apiHash == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var apiHashTmp = this.apiHash.getBytes(StandardCharsets.UTF_8); + output.writeInt(apiHashTmp.length); + output.write(apiHashTmp); + } + if (this.systemLanguageCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var systemLanguageCodeTmp = this.systemLanguageCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(systemLanguageCodeTmp.length); + output.write(systemLanguageCodeTmp); + } + if (this.deviceModel == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var deviceModelTmp = this.deviceModel.getBytes(StandardCharsets.UTF_8); + output.writeInt(deviceModelTmp.length); + output.write(deviceModelTmp); + } + if (this.systemVersion == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var systemVersionTmp = this.systemVersion.getBytes(StandardCharsets.UTF_8); + output.writeInt(systemVersionTmp.length); + output.write(systemVersionTmp); + } + if (this.applicationVersion == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var applicationVersionTmp = this.applicationVersion.getBytes(StandardCharsets.UTF_8); + output.writeInt(applicationVersionTmp.length); + output.write(applicationVersionTmp); + } + output.writeBoolean(this.enableStorageOptimizer); + output.writeBoolean(this.ignoreFileNames); + } } public static class TemporaryPasswordState extends Object { public boolean hasPassword; public int validFor; - public TemporaryPasswordState() { - } + public static final int CONSTRUCTOR = 939837410; + + public TemporaryPasswordState() {} public TemporaryPasswordState(boolean hasPassword, int validFor) { this.hasPassword = hasPassword; this.validFor = validFor; } - public static final int CONSTRUCTOR = 939837410; + public TemporaryPasswordState(DataInputStream input) throws IOException { + this.hasPassword = input.readBoolean(); + this.validFor = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.hasPassword); + output.writeInt(this.validFor); + } } public static class TermsOfService extends Object { @@ -12412,8 +33072,9 @@ public class TdApi { public int minUserAge; public boolean showPopup; - public TermsOfService() { - } + public static final int CONSTRUCTOR = 739422597; + + public TermsOfService() {} public TermsOfService(FormattedText text, int minUserAge, boolean showPopup) { this.text = text; @@ -12421,174 +33082,324 @@ public class TdApi { this.showPopup = showPopup; } - public static final int CONSTRUCTOR = 739422597; + public TermsOfService(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + this.minUserAge = input.readInt(); + this.showPopup = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + output.writeInt(this.minUserAge); + output.writeBoolean(this.showPopup); + } } public static class TestBytes extends Object { public byte[] value; - public TestBytes() { - } + public static final int CONSTRUCTOR = -1541225250; + + public TestBytes() {} public TestBytes(byte[] value) { this.value = value; } - public static final int CONSTRUCTOR = -1541225250; + public TestBytes(DataInputStream input) throws IOException { + this.value = new byte[input.readInt()]; + input.readFully(this.value); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value.length); + output.write(this.value); + } } public static class TestInt extends Object { public int value; - public TestInt() { - } + public static final int CONSTRUCTOR = -574804983; + + public TestInt() {} public TestInt(int value) { this.value = value; } - public static final int CONSTRUCTOR = -574804983; + public TestInt(DataInputStream input) throws IOException { + this.value = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value); + } } public static class TestString extends Object { public String value; - public TestString() { - } + public static final int CONSTRUCTOR = -27891572; + + public TestString() {} public TestString(String value) { this.value = value; } - public static final int CONSTRUCTOR = -27891572; + public TestString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var valueTmp = new byte[input.readInt()]; + input.readFully(valueTmp); + this.value = new String(valueTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var valueTmp = this.value.getBytes(StandardCharsets.UTF_8); + output.writeInt(valueTmp.length); + output.write(valueTmp); + } + } } public static class TestVectorInt extends Object { public int[] value; - public TestVectorInt() { - } + public static final int CONSTRUCTOR = 593682027; + + public TestVectorInt() {} public TestVectorInt(int[] value) { this.value = value; } - public static final int CONSTRUCTOR = 593682027; + public TestVectorInt(DataInputStream input) throws IOException { + this.value = new int[input.readInt()]; + for (int i = 0; i < this.value.length; i++) { + this.value[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value.length); + for (int i = 0; i < this.value.length; i++) { + output.writeInt(this.value[i]); + } + } } public static class TestVectorIntObject extends Object { public TestInt[] value; - public TestVectorIntObject() { - } + public static final int CONSTRUCTOR = 125891546; + + public TestVectorIntObject() {} public TestVectorIntObject(TestInt[] value) { this.value = value; } - public static final int CONSTRUCTOR = 125891546; + public TestVectorIntObject(DataInputStream input) throws IOException { + this.value = new TestInt[input.readInt()]; + for (int i = 0; i < this.value.length; i++) { + if (TestInt.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.value[i] = new TestInt(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value.length); + for (int i = 0; i < this.value.length; i++) { + this.value[i].serialize(output); + } + } } public static class TestVectorString extends Object { public String[] value; - public TestVectorString() { - } + public static final int CONSTRUCTOR = 79339995; + + public TestVectorString() {} public TestVectorString(String[] value) { this.value = value; } - public static final int CONSTRUCTOR = 79339995; + public TestVectorString(DataInputStream input) throws IOException { + this.value = new String[input.readInt()]; + for (int i = 0; i < this.value.length; i++) { + var valueTmp = new byte[input.readInt()]; + input.readFully(valueTmp); + this.value[i] = new String(valueTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value.length); + for (int i = 0; i < this.value.length; i++) { + var valueTmp = this.value[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(valueTmp.length); + output.write(valueTmp); + } + } } public static class TestVectorStringObject extends Object { public TestString[] value; - public TestVectorStringObject() { - } + public static final int CONSTRUCTOR = 80780537; + + public TestVectorStringObject() {} public TestVectorStringObject(TestString[] value) { this.value = value; } - public static final int CONSTRUCTOR = 80780537; + public TestVectorStringObject(DataInputStream input) throws IOException { + this.value = new TestString[input.readInt()]; + for (int i = 0; i < this.value.length; i++) { + if (TestString.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.value[i] = new TestString(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.value.length); + for (int i = 0; i < this.value.length; i++) { + this.value[i].serialize(output); + } + } } public static class Text extends Object { public String text; - public Text() { - } + public static final int CONSTRUCTOR = 578181272; + + public Text() {} public Text(String text) { this.text = text; } - public static final int CONSTRUCTOR = 578181272; + public Text(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + } } public static class TextEntities extends Object { public TextEntity[] entities; - public TextEntities() { - } + public static final int CONSTRUCTOR = -933199172; + + public TextEntities() {} public TextEntities(TextEntity[] entities) { this.entities = entities; } - public static final int CONSTRUCTOR = -933199172; + public TextEntities(DataInputStream input) throws IOException { + this.entities = new TextEntity[input.readInt()]; + for (int i = 0; i < this.entities.length; i++) { + if (TextEntity.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.entities[i] = new TextEntity(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.entities.length); + for (int i = 0; i < this.entities.length; i++) { + this.entities[i].serialize(output); + } + } } public static class TextEntity extends Object { @@ -12596,8 +33407,9 @@ public class TdApi { public int length; public TextEntityType type; - public TextEntity() { - } + public static final int CONSTRUCTOR = -1951688280; + + public TextEntity() {} public TextEntity(int offset, int length, TextEntityType type) { this.offset = offset; @@ -12605,458 +33417,772 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = -1951688280; + public TextEntity(DataInputStream input) throws IOException { + this.offset = input.readInt(); + this.length = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case TextEntityTypeMention.CONSTRUCTOR: + this.type = new TextEntityTypeMention(input); + break; + case TextEntityTypeHashtag.CONSTRUCTOR: + this.type = new TextEntityTypeHashtag(input); + break; + case TextEntityTypeCashtag.CONSTRUCTOR: + this.type = new TextEntityTypeCashtag(input); + break; + case TextEntityTypeBotCommand.CONSTRUCTOR: + this.type = new TextEntityTypeBotCommand(input); + break; + case TextEntityTypeUrl.CONSTRUCTOR: + this.type = new TextEntityTypeUrl(input); + break; + case TextEntityTypeEmailAddress.CONSTRUCTOR: + this.type = new TextEntityTypeEmailAddress(input); + break; + case TextEntityTypePhoneNumber.CONSTRUCTOR: + this.type = new TextEntityTypePhoneNumber(input); + break; + case TextEntityTypeBankCardNumber.CONSTRUCTOR: + this.type = new TextEntityTypeBankCardNumber(input); + break; + case TextEntityTypeBold.CONSTRUCTOR: + this.type = new TextEntityTypeBold(input); + break; + case TextEntityTypeItalic.CONSTRUCTOR: + this.type = new TextEntityTypeItalic(input); + break; + case TextEntityTypeUnderline.CONSTRUCTOR: + this.type = new TextEntityTypeUnderline(input); + break; + case TextEntityTypeStrikethrough.CONSTRUCTOR: + this.type = new TextEntityTypeStrikethrough(input); + break; + case TextEntityTypeCode.CONSTRUCTOR: + this.type = new TextEntityTypeCode(input); + break; + case TextEntityTypePre.CONSTRUCTOR: + this.type = new TextEntityTypePre(input); + break; + case TextEntityTypePreCode.CONSTRUCTOR: + this.type = new TextEntityTypePreCode(input); + break; + case TextEntityTypeTextUrl.CONSTRUCTOR: + this.type = new TextEntityTypeTextUrl(input); + break; + case TextEntityTypeMentionName.CONSTRUCTOR: + this.type = new TextEntityTypeMentionName(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class TextEntityType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.offset); + output.writeInt(this.length); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class TextEntityTypeMention extends TextEntityType { - - public TextEntityTypeMention() { - } - public static final int CONSTRUCTOR = 934535013; - @Override + public TextEntityTypeMention() {} + + + public TextEntityTypeMention(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeHashtag extends TextEntityType { - - public TextEntityTypeHashtag() { - } - public static final int CONSTRUCTOR = -1023958307; - @Override + public TextEntityTypeHashtag() {} + + + public TextEntityTypeHashtag(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeCashtag extends TextEntityType { - - public TextEntityTypeCashtag() { - } - public static final int CONSTRUCTOR = 1222915915; - @Override + public TextEntityTypeCashtag() {} + + + public TextEntityTypeCashtag(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeBotCommand extends TextEntityType { - - public TextEntityTypeBotCommand() { - } - public static final int CONSTRUCTOR = -1150997581; - @Override + public TextEntityTypeBotCommand() {} + + + public TextEntityTypeBotCommand(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeUrl extends TextEntityType { - - public TextEntityTypeUrl() { - } - public static final int CONSTRUCTOR = -1312762756; - @Override + public TextEntityTypeUrl() {} + + + public TextEntityTypeUrl(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeEmailAddress extends TextEntityType { - - public TextEntityTypeEmailAddress() { - } - public static final int CONSTRUCTOR = 1425545249; - @Override + public TextEntityTypeEmailAddress() {} + + + public TextEntityTypeEmailAddress(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypePhoneNumber extends TextEntityType { - - public TextEntityTypePhoneNumber() { - } - public static final int CONSTRUCTOR = -1160140246; - @Override + public TextEntityTypePhoneNumber() {} + + + public TextEntityTypePhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeBankCardNumber extends TextEntityType { - - public TextEntityTypeBankCardNumber() { - } - public static final int CONSTRUCTOR = 105986320; - @Override + public TextEntityTypeBankCardNumber() {} + + + public TextEntityTypeBankCardNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeBold extends TextEntityType { - - public TextEntityTypeBold() { - } - public static final int CONSTRUCTOR = -1128210000; - @Override + public TextEntityTypeBold() {} + + + public TextEntityTypeBold(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeItalic extends TextEntityType { - - public TextEntityTypeItalic() { - } - public static final int CONSTRUCTOR = -118253987; - @Override + public TextEntityTypeItalic() {} + + + public TextEntityTypeItalic(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeUnderline extends TextEntityType { - - public TextEntityTypeUnderline() { - } - public static final int CONSTRUCTOR = 792317842; - @Override + public TextEntityTypeUnderline() {} + + + public TextEntityTypeUnderline(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeStrikethrough extends TextEntityType { - - public TextEntityTypeStrikethrough() { - } - public static final int CONSTRUCTOR = 961529082; - @Override + public TextEntityTypeStrikethrough() {} + + + public TextEntityTypeStrikethrough(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypeCode extends TextEntityType { - - public TextEntityTypeCode() { - } - public static final int CONSTRUCTOR = -974534326; - @Override + public TextEntityTypeCode() {} + + + public TextEntityTypeCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypePre extends TextEntityType { - - public TextEntityTypePre() { - } - public static final int CONSTRUCTOR = 1648958606; - @Override + public TextEntityTypePre() {} + + + public TextEntityTypePre(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TextEntityTypePreCode extends TextEntityType { public String language; - public TextEntityTypePreCode() { - } + public static final int CONSTRUCTOR = -945325397; + + public TextEntityTypePreCode() {} public TextEntityTypePreCode(String language) { this.language = language; } - public static final int CONSTRUCTOR = -945325397; + public TextEntityTypePreCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languageTmp = new byte[input.readInt()]; + input.readFully(languageTmp); + this.language = new String(languageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.language == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languageTmp = this.language.getBytes(StandardCharsets.UTF_8); + output.writeInt(languageTmp.length); + output.write(languageTmp); + } + } } public static class TextEntityTypeTextUrl extends TextEntityType { public String url; - public TextEntityTypeTextUrl() { - } + public static final int CONSTRUCTOR = 445719651; + + public TextEntityTypeTextUrl() {} public TextEntityTypeTextUrl(String url) { this.url = url; } - public static final int CONSTRUCTOR = 445719651; + public TextEntityTypeTextUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class TextEntityTypeMentionName extends TextEntityType { public int userId; - public TextEntityTypeMentionName() { - } + public static final int CONSTRUCTOR = -791517091; + + public TextEntityTypeMentionName() {} public TextEntityTypeMentionName(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -791517091; + public TextEntityTypeMentionName(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class TextParseMode extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class TextParseModeMarkdown extends TextParseMode { public int version; - public TextParseModeMarkdown() { - } + public static final int CONSTRUCTOR = 360073407; + + public TextParseModeMarkdown() {} public TextParseModeMarkdown(int version) { this.version = version; } - public static final int CONSTRUCTOR = 360073407; + public TextParseModeMarkdown(DataInputStream input) throws IOException { + this.version = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.version); + } } public static class TextParseModeHTML extends TextParseMode { - - public TextParseModeHTML() { - } - public static final int CONSTRUCTOR = 1660208627; - @Override + public TextParseModeHTML() {} + + + public TextParseModeHTML(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class TopChatCategory extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryUsers extends TopChatCategory { - - public TopChatCategoryUsers() { - } - public static final int CONSTRUCTOR = 1026706816; - @Override + public TopChatCategoryUsers() {} + + + public TopChatCategoryUsers(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryBots extends TopChatCategory { - - public TopChatCategoryBots() { - } - public static final int CONSTRUCTOR = -1577129195; - @Override + public TopChatCategoryBots() {} + + + public TopChatCategoryBots(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryGroups extends TopChatCategory { - - public TopChatCategoryGroups() { - } - public static final int CONSTRUCTOR = 1530056846; - @Override + public TopChatCategoryGroups() {} + + + public TopChatCategoryGroups(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryChannels extends TopChatCategory { - - public TopChatCategoryChannels() { - } - public static final int CONSTRUCTOR = -500825885; - @Override + public TopChatCategoryChannels() {} + + + public TopChatCategoryChannels(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryInlineBots extends TopChatCategory { - - public TopChatCategoryInlineBots() { - } - public static final int CONSTRUCTOR = 377023356; - @Override + public TopChatCategoryInlineBots() {} + + + public TopChatCategoryInlineBots(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryCalls extends TopChatCategory { - - public TopChatCategoryCalls() { - } - public static final int CONSTRUCTOR = 356208861; - @Override + public TopChatCategoryCalls() {} + + + public TopChatCategoryCalls(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TopChatCategoryForwardChats extends TopChatCategory { - - public TopChatCategoryForwardChats() { - } - public static final int CONSTRUCTOR = 1695922133; - @Override + public TopChatCategoryForwardChats() {} + + + public TopChatCategoryForwardChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class Update extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UpdateAuthorizationState extends Update { public AuthorizationState authorizationState; - public UpdateAuthorizationState() { - } + public static final int CONSTRUCTOR = 1622347490; + + public UpdateAuthorizationState() {} public UpdateAuthorizationState(AuthorizationState authorizationState) { this.authorizationState = authorizationState; } - public static final int CONSTRUCTOR = 1622347490; + public UpdateAuthorizationState(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case AuthorizationStateWaitTdlibParameters.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitTdlibParameters(input); + break; + case AuthorizationStateWaitEncryptionKey.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitEncryptionKey(input); + break; + case AuthorizationStateWaitPhoneNumber.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitPhoneNumber(input); + break; + case AuthorizationStateWaitCode.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitCode(input); + break; + case AuthorizationStateWaitOtherDeviceConfirmation.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitOtherDeviceConfirmation(input); + break; + case AuthorizationStateWaitRegistration.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitRegistration(input); + break; + case AuthorizationStateWaitPassword.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateWaitPassword(input); + break; + case AuthorizationStateReady.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateReady(input); + break; + case AuthorizationStateLoggingOut.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateLoggingOut(input); + break; + case AuthorizationStateClosing.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateClosing(input); + break; + case AuthorizationStateClosed.CONSTRUCTOR: + this.authorizationState = new AuthorizationStateClosed(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.authorizationState == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.authorizationState.serialize(output); + } + } } public static class UpdateNewMessage extends Update { public Message message; - public UpdateNewMessage() { - } + public static final int CONSTRUCTOR = -563105266; + + public UpdateNewMessage() {} public UpdateNewMessage(Message message) { this.message = message; } - public static final int CONSTRUCTOR = -563105266; + public UpdateNewMessage(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + } } public static class UpdateMessageSendAcknowledged extends Update { public long chatId; public long messageId; - public UpdateMessageSendAcknowledged() { - } + public static final int CONSTRUCTOR = 1302843961; + + public UpdateMessageSendAcknowledged() {} public UpdateMessageSendAcknowledged(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = 1302843961; + public UpdateMessageSendAcknowledged(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class UpdateMessageSendSucceeded extends Update { public Message message; public long oldMessageId; - public UpdateMessageSendSucceeded() { - } + public static final int CONSTRUCTOR = 1815715197; + + public UpdateMessageSendSucceeded() {} public UpdateMessageSendSucceeded(Message message, long oldMessageId) { this.message = message; this.oldMessageId = oldMessageId; } - public static final int CONSTRUCTOR = 1815715197; + public UpdateMessageSendSucceeded(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + this.oldMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + output.writeLong(this.oldMessageId); + } } public static class UpdateMessageSendFailed extends Update { @@ -13065,8 +34191,9 @@ public class TdApi { public int errorCode; public String errorMessage; - public UpdateMessageSendFailed() { - } + public static final int CONSTRUCTOR = -1032335779; + + public UpdateMessageSendFailed() {} public UpdateMessageSendFailed(Message message, long oldMessageId, int errorCode, String errorMessage) { this.message = message; @@ -13075,12 +34202,45 @@ public class TdApi { this.errorMessage = errorMessage; } - public static final int CONSTRUCTOR = -1032335779; + public UpdateMessageSendFailed(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.message = new Message(input); + } + this.oldMessageId = input.readLong(); + this.errorCode = input.readInt(); + if (input.readBoolean()) { + var errorMessageTmp = new byte[input.readInt()]; + input.readFully(errorMessageTmp); + this.errorMessage = new String(errorMessageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.message == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.message.serialize(output); + } + output.writeLong(this.oldMessageId); + output.writeInt(this.errorCode); + if (this.errorMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var errorMessageTmp = this.errorMessage.getBytes(StandardCharsets.UTF_8); + output.writeInt(errorMessageTmp.length); + output.write(errorMessageTmp); + } + } } public static class UpdateMessageContent extends Update { @@ -13088,8 +34248,9 @@ public class TdApi { public long messageId; public MessageContent newContent; - public UpdateMessageContent() { - } + public static final int CONSTRUCTOR = 506903332; + + public UpdateMessageContent() {} public UpdateMessageContent(long chatId, long messageId, MessageContent newContent) { this.chatId = chatId; @@ -13097,12 +34258,155 @@ public class TdApi { this.newContent = newContent; } - public static final int CONSTRUCTOR = 506903332; + public UpdateMessageContent(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageText.CONSTRUCTOR: + this.newContent = new MessageText(input); + break; + case MessageAnimation.CONSTRUCTOR: + this.newContent = new MessageAnimation(input); + break; + case MessageAudio.CONSTRUCTOR: + this.newContent = new MessageAudio(input); + break; + case MessageDocument.CONSTRUCTOR: + this.newContent = new MessageDocument(input); + break; + case MessagePhoto.CONSTRUCTOR: + this.newContent = new MessagePhoto(input); + break; + case MessageExpiredPhoto.CONSTRUCTOR: + this.newContent = new MessageExpiredPhoto(input); + break; + case MessageSticker.CONSTRUCTOR: + this.newContent = new MessageSticker(input); + break; + case MessageVideo.CONSTRUCTOR: + this.newContent = new MessageVideo(input); + break; + case MessageExpiredVideo.CONSTRUCTOR: + this.newContent = new MessageExpiredVideo(input); + break; + case MessageVideoNote.CONSTRUCTOR: + this.newContent = new MessageVideoNote(input); + break; + case MessageVoiceNote.CONSTRUCTOR: + this.newContent = new MessageVoiceNote(input); + break; + case MessageLocation.CONSTRUCTOR: + this.newContent = new MessageLocation(input); + break; + case MessageVenue.CONSTRUCTOR: + this.newContent = new MessageVenue(input); + break; + case MessageContact.CONSTRUCTOR: + this.newContent = new MessageContact(input); + break; + case MessageDice.CONSTRUCTOR: + this.newContent = new MessageDice(input); + break; + case MessageGame.CONSTRUCTOR: + this.newContent = new MessageGame(input); + break; + case MessagePoll.CONSTRUCTOR: + this.newContent = new MessagePoll(input); + break; + case MessageInvoice.CONSTRUCTOR: + this.newContent = new MessageInvoice(input); + break; + case MessageCall.CONSTRUCTOR: + this.newContent = new MessageCall(input); + break; + case MessageBasicGroupChatCreate.CONSTRUCTOR: + this.newContent = new MessageBasicGroupChatCreate(input); + break; + case MessageSupergroupChatCreate.CONSTRUCTOR: + this.newContent = new MessageSupergroupChatCreate(input); + break; + case MessageChatChangeTitle.CONSTRUCTOR: + this.newContent = new MessageChatChangeTitle(input); + break; + case MessageChatChangePhoto.CONSTRUCTOR: + this.newContent = new MessageChatChangePhoto(input); + break; + case MessageChatDeletePhoto.CONSTRUCTOR: + this.newContent = new MessageChatDeletePhoto(input); + break; + case MessageChatAddMembers.CONSTRUCTOR: + this.newContent = new MessageChatAddMembers(input); + break; + case MessageChatJoinByLink.CONSTRUCTOR: + this.newContent = new MessageChatJoinByLink(input); + break; + case MessageChatDeleteMember.CONSTRUCTOR: + this.newContent = new MessageChatDeleteMember(input); + break; + case MessageChatUpgradeTo.CONSTRUCTOR: + this.newContent = new MessageChatUpgradeTo(input); + break; + case MessageChatUpgradeFrom.CONSTRUCTOR: + this.newContent = new MessageChatUpgradeFrom(input); + break; + case MessagePinMessage.CONSTRUCTOR: + this.newContent = new MessagePinMessage(input); + break; + case MessageScreenshotTaken.CONSTRUCTOR: + this.newContent = new MessageScreenshotTaken(input); + break; + case MessageChatSetTtl.CONSTRUCTOR: + this.newContent = new MessageChatSetTtl(input); + break; + case MessageCustomServiceAction.CONSTRUCTOR: + this.newContent = new MessageCustomServiceAction(input); + break; + case MessageGameScore.CONSTRUCTOR: + this.newContent = new MessageGameScore(input); + break; + case MessagePaymentSuccessful.CONSTRUCTOR: + this.newContent = new MessagePaymentSuccessful(input); + break; + case MessagePaymentSuccessfulBot.CONSTRUCTOR: + this.newContent = new MessagePaymentSuccessfulBot(input); + break; + case MessageContactRegistered.CONSTRUCTOR: + this.newContent = new MessageContactRegistered(input); + break; + case MessageWebsiteConnected.CONSTRUCTOR: + this.newContent = new MessageWebsiteConnected(input); + break; + case MessagePassportDataSent.CONSTRUCTOR: + this.newContent = new MessagePassportDataSent(input); + break; + case MessagePassportDataReceived.CONSTRUCTOR: + this.newContent = new MessagePassportDataReceived(input); + break; + case MessageUnsupported.CONSTRUCTOR: + this.newContent = new MessageUnsupported(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.newContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newContent.serialize(output); + } + } } public static class UpdateMessageEdited extends Update { @@ -13111,8 +34415,9 @@ public class TdApi { public int editDate; public ReplyMarkup replyMarkup; - public UpdateMessageEdited() { - } + public static final int CONSTRUCTOR = -559545626; + + public UpdateMessageEdited() {} public UpdateMessageEdited(long chatId, long messageId, int editDate, ReplyMarkup replyMarkup) { this.chatId = chatId; @@ -13121,12 +34426,46 @@ public class TdApi { this.replyMarkup = replyMarkup; } - public static final int CONSTRUCTOR = -559545626; + public UpdateMessageEdited(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.editDate = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.editDate); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + } } public static class UpdateMessageViews extends Update { @@ -13134,8 +34473,9 @@ public class TdApi { public long messageId; public int views; - public UpdateMessageViews() { - } + public static final int CONSTRUCTOR = -1854131125; + + public UpdateMessageViews() {} public UpdateMessageViews(long chatId, long messageId, int views) { this.chatId = chatId; @@ -13143,32 +34483,51 @@ public class TdApi { this.views = views; } - public static final int CONSTRUCTOR = -1854131125; + public UpdateMessageViews(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.views = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.views); + } } public static class UpdateMessageContentOpened extends Update { public long chatId; public long messageId; - public UpdateMessageContentOpened() { - } + public static final int CONSTRUCTOR = -1520523131; + + public UpdateMessageContentOpened() {} public UpdateMessageContentOpened(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -1520523131; + public UpdateMessageContentOpened(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class UpdateMessageMentionRead extends Update { @@ -13176,8 +34535,9 @@ public class TdApi { public long messageId; public int unreadMentionCount; - public UpdateMessageMentionRead() { - } + public static final int CONSTRUCTOR = -252228282; + + public UpdateMessageMentionRead() {} public UpdateMessageMentionRead(long chatId, long messageId, int unreadMentionCount) { this.chatId = chatId; @@ -13185,130 +34545,249 @@ public class TdApi { this.unreadMentionCount = unreadMentionCount; } - public static final int CONSTRUCTOR = -252228282; + public UpdateMessageMentionRead(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.unreadMentionCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.unreadMentionCount); + } } public static class UpdateMessageLiveLocationViewed extends Update { public long chatId; public long messageId; - public UpdateMessageLiveLocationViewed() { - } + public static final int CONSTRUCTOR = -1308260971; + + public UpdateMessageLiveLocationViewed() {} public UpdateMessageLiveLocationViewed(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -1308260971; + public UpdateMessageLiveLocationViewed(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class UpdateNewChat extends Update { public Chat chat; - public UpdateNewChat() { - } + public static final int CONSTRUCTOR = 2075757773; + + public UpdateNewChat() {} public UpdateNewChat(Chat chat) { this.chat = chat; } - public static final int CONSTRUCTOR = 2075757773; + public UpdateNewChat(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Chat.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.chat = new Chat(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.chat == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chat.serialize(output); + } + } } public static class UpdateChatChatList extends Update { public long chatId; public ChatList chatList; - public UpdateChatChatList() { - } + public static final int CONSTRUCTOR = -170455894; + + public UpdateChatChatList() {} public UpdateChatChatList(long chatId, ChatList chatList) { this.chatId = chatId; this.chatList = chatList; } - public static final int CONSTRUCTOR = -170455894; + public UpdateChatChatList(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + } } public static class UpdateChatTitle extends Update { public long chatId; public String title; - public UpdateChatTitle() { - } + public static final int CONSTRUCTOR = -175405660; + + public UpdateChatTitle() {} public UpdateChatTitle(long chatId, String title) { this.chatId = chatId; this.title = title; } - public static final int CONSTRUCTOR = -175405660; + public UpdateChatTitle(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class UpdateChatPhoto extends Update { public long chatId; public ChatPhoto photo; - public UpdateChatPhoto() { - } + public static final int CONSTRUCTOR = -209353966; + + public UpdateChatPhoto() {} public UpdateChatPhoto(long chatId, ChatPhoto photo) { this.chatId = chatId; this.photo = photo; } - public static final int CONSTRUCTOR = -209353966; + public UpdateChatPhoto(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (ChatPhoto.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new ChatPhoto(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + } } public static class UpdateChatPermissions extends Update { public long chatId; public ChatPermissions permissions; - public UpdateChatPermissions() { - } + public static final int CONSTRUCTOR = -1622010003; + + public UpdateChatPermissions() {} public UpdateChatPermissions(long chatId, ChatPermissions permissions) { this.chatId = chatId; this.permissions = permissions; } - public static final int CONSTRUCTOR = -1622010003; + public UpdateChatPermissions(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (ChatPermissions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.permissions = new ChatPermissions(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.permissions == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.permissions.serialize(output); + } + } } public static class UpdateChatLastMessage extends Update { @@ -13316,8 +34795,9 @@ public class TdApi { public Message lastMessage; public long order; - public UpdateChatLastMessage() { - } + public static final int CONSTRUCTOR = 580348828; + + public UpdateChatLastMessage() {} public UpdateChatLastMessage(long chatId, Message lastMessage, long order) { this.chatId = chatId; @@ -13325,32 +34805,61 @@ public class TdApi { this.order = order; } - public static final int CONSTRUCTOR = 580348828; + public UpdateChatLastMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (Message.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.lastMessage = new Message(input); + } + this.order = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.lastMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.lastMessage.serialize(output); + } + output.writeLong(this.order); + } } public static class UpdateChatOrder extends Update { public long chatId; public long order; - public UpdateChatOrder() { - } + public static final int CONSTRUCTOR = -1601888026; + + public UpdateChatOrder() {} public UpdateChatOrder(long chatId, long order) { this.chatId = chatId; this.order = order; } - public static final int CONSTRUCTOR = -1601888026; + public UpdateChatOrder(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.order = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.order); + } } public static class UpdateChatIsPinned extends Update { @@ -13358,8 +34867,9 @@ public class TdApi { public boolean isPinned; public long order; - public UpdateChatIsPinned() { - } + public static final int CONSTRUCTOR = 488876260; + + public UpdateChatIsPinned() {} public UpdateChatIsPinned(long chatId, boolean isPinned, long order) { this.chatId = chatId; @@ -13367,32 +34877,51 @@ public class TdApi { this.order = order; } - public static final int CONSTRUCTOR = 488876260; + public UpdateChatIsPinned(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.isPinned = input.readBoolean(); + this.order = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.isPinned); + output.writeLong(this.order); + } } public static class UpdateChatIsMarkedAsUnread extends Update { public long chatId; public boolean isMarkedAsUnread; - public UpdateChatIsMarkedAsUnread() { - } + public static final int CONSTRUCTOR = 1468347188; + + public UpdateChatIsMarkedAsUnread() {} public UpdateChatIsMarkedAsUnread(long chatId, boolean isMarkedAsUnread) { this.chatId = chatId; this.isMarkedAsUnread = isMarkedAsUnread; } - public static final int CONSTRUCTOR = 1468347188; + public UpdateChatIsMarkedAsUnread(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.isMarkedAsUnread = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.isMarkedAsUnread); + } } public static class UpdateChatIsSponsored extends Update { @@ -13400,8 +34929,9 @@ public class TdApi { public boolean isSponsored; public long order; - public UpdateChatIsSponsored() { - } + public static final int CONSTRUCTOR = -1196180070; + + public UpdateChatIsSponsored() {} public UpdateChatIsSponsored(long chatId, boolean isSponsored, long order) { this.chatId = chatId; @@ -13409,52 +34939,80 @@ public class TdApi { this.order = order; } - public static final int CONSTRUCTOR = -1196180070; + public UpdateChatIsSponsored(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.isSponsored = input.readBoolean(); + this.order = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.isSponsored); + output.writeLong(this.order); + } } public static class UpdateChatHasScheduledMessages extends Update { public long chatId; public boolean hasScheduledMessages; - public UpdateChatHasScheduledMessages() { - } + public static final int CONSTRUCTOR = 2064958167; + + public UpdateChatHasScheduledMessages() {} public UpdateChatHasScheduledMessages(long chatId, boolean hasScheduledMessages) { this.chatId = chatId; this.hasScheduledMessages = hasScheduledMessages; } - public static final int CONSTRUCTOR = 2064958167; + public UpdateChatHasScheduledMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.hasScheduledMessages = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.hasScheduledMessages); + } } public static class UpdateChatDefaultDisableNotification extends Update { public long chatId; public boolean defaultDisableNotification; - public UpdateChatDefaultDisableNotification() { - } + public static final int CONSTRUCTOR = 464087707; + + public UpdateChatDefaultDisableNotification() {} public UpdateChatDefaultDisableNotification(long chatId, boolean defaultDisableNotification) { this.chatId = chatId; this.defaultDisableNotification = defaultDisableNotification; } - public static final int CONSTRUCTOR = 464087707; + public UpdateChatDefaultDisableNotification(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.defaultDisableNotification = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.defaultDisableNotification); + } } public static class UpdateChatReadInbox extends Update { @@ -13462,8 +35020,9 @@ public class TdApi { public long lastReadInboxMessageId; public int unreadCount; - public UpdateChatReadInbox() { - } + public static final int CONSTRUCTOR = -797952281; + + public UpdateChatReadInbox() {} public UpdateChatReadInbox(long chatId, long lastReadInboxMessageId, int unreadCount) { this.chatId = chatId; @@ -13471,152 +35030,289 @@ public class TdApi { this.unreadCount = unreadCount; } - public static final int CONSTRUCTOR = -797952281; + public UpdateChatReadInbox(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.lastReadInboxMessageId = input.readLong(); + this.unreadCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.lastReadInboxMessageId); + output.writeInt(this.unreadCount); + } } public static class UpdateChatReadOutbox extends Update { public long chatId; public long lastReadOutboxMessageId; - public UpdateChatReadOutbox() { - } + public static final int CONSTRUCTOR = 708334213; + + public UpdateChatReadOutbox() {} public UpdateChatReadOutbox(long chatId, long lastReadOutboxMessageId) { this.chatId = chatId; this.lastReadOutboxMessageId = lastReadOutboxMessageId; } - public static final int CONSTRUCTOR = 708334213; + public UpdateChatReadOutbox(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.lastReadOutboxMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.lastReadOutboxMessageId); + } } public static class UpdateChatUnreadMentionCount extends Update { public long chatId; public int unreadMentionCount; - public UpdateChatUnreadMentionCount() { - } + public static final int CONSTRUCTOR = -2131461348; + + public UpdateChatUnreadMentionCount() {} public UpdateChatUnreadMentionCount(long chatId, int unreadMentionCount) { this.chatId = chatId; this.unreadMentionCount = unreadMentionCount; } - public static final int CONSTRUCTOR = -2131461348; + public UpdateChatUnreadMentionCount(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.unreadMentionCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.unreadMentionCount); + } } public static class UpdateChatNotificationSettings extends Update { public long chatId; public ChatNotificationSettings notificationSettings; - public UpdateChatNotificationSettings() { - } + public static final int CONSTRUCTOR = -803163050; + + public UpdateChatNotificationSettings() {} public UpdateChatNotificationSettings(long chatId, ChatNotificationSettings notificationSettings) { this.chatId = chatId; this.notificationSettings = notificationSettings; } - public static final int CONSTRUCTOR = -803163050; + public UpdateChatNotificationSettings(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (ChatNotificationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notificationSettings = new ChatNotificationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.notificationSettings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.notificationSettings.serialize(output); + } + } } public static class UpdateScopeNotificationSettings extends Update { public NotificationSettingsScope scope; public ScopeNotificationSettings notificationSettings; - public UpdateScopeNotificationSettings() { - } + public static final int CONSTRUCTOR = -1203975309; + + public UpdateScopeNotificationSettings() {} public UpdateScopeNotificationSettings(NotificationSettingsScope scope, ScopeNotificationSettings notificationSettings) { this.scope = scope; this.notificationSettings = notificationSettings; } - public static final int CONSTRUCTOR = -1203975309; + public UpdateScopeNotificationSettings(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationSettingsScopePrivateChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopePrivateChats(input); + break; + case NotificationSettingsScopeGroupChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeGroupChats(input); + break; + case NotificationSettingsScopeChannelChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeChannelChats(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (ScopeNotificationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notificationSettings = new ScopeNotificationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.scope == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.scope.serialize(output); + } + if (this.notificationSettings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.notificationSettings.serialize(output); + } + } } public static class UpdateChatActionBar extends Update { public long chatId; public ChatActionBar actionBar; - public UpdateChatActionBar() { - } + public static final int CONSTRUCTOR = -643671870; + + public UpdateChatActionBar() {} public UpdateChatActionBar(long chatId, ChatActionBar actionBar) { this.chatId = chatId; this.actionBar = actionBar; } - public static final int CONSTRUCTOR = -643671870; + public UpdateChatActionBar(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatActionBarReportSpam.CONSTRUCTOR: + this.actionBar = new ChatActionBarReportSpam(input); + break; + case ChatActionBarReportUnrelatedLocation.CONSTRUCTOR: + this.actionBar = new ChatActionBarReportUnrelatedLocation(input); + break; + case ChatActionBarReportAddBlock.CONSTRUCTOR: + this.actionBar = new ChatActionBarReportAddBlock(input); + break; + case ChatActionBarAddContact.CONSTRUCTOR: + this.actionBar = new ChatActionBarAddContact(input); + break; + case ChatActionBarSharePhoneNumber.CONSTRUCTOR: + this.actionBar = new ChatActionBarSharePhoneNumber(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.actionBar == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.actionBar.serialize(output); + } + } } public static class UpdateChatPinnedMessage extends Update { public long chatId; public long pinnedMessageId; - public UpdateChatPinnedMessage() { - } + public static final int CONSTRUCTOR = 802160507; + + public UpdateChatPinnedMessage() {} public UpdateChatPinnedMessage(long chatId, long pinnedMessageId) { this.chatId = chatId; this.pinnedMessageId = pinnedMessageId; } - public static final int CONSTRUCTOR = 802160507; + public UpdateChatPinnedMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.pinnedMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.pinnedMessageId); + } } public static class UpdateChatReplyMarkup extends Update { public long chatId; public long replyMarkupMessageId; - public UpdateChatReplyMarkup() { - } + public static final int CONSTRUCTOR = 1309386144; + + public UpdateChatReplyMarkup() {} public UpdateChatReplyMarkup(long chatId, long replyMarkupMessageId) { this.chatId = chatId; this.replyMarkupMessageId = replyMarkupMessageId; } - public static final int CONSTRUCTOR = 1309386144; + public UpdateChatReplyMarkup(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.replyMarkupMessageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.replyMarkupMessageId); + } } public static class UpdateChatDraftMessage extends Update { @@ -13624,8 +35320,9 @@ public class TdApi { public DraftMessage draftMessage; public long order; - public UpdateChatDraftMessage() { - } + public static final int CONSTRUCTOR = -1436617498; + + public UpdateChatDraftMessage() {} public UpdateChatDraftMessage(long chatId, DraftMessage draftMessage, long order) { this.chatId = chatId; @@ -13633,52 +35330,100 @@ public class TdApi { this.order = order; } - public static final int CONSTRUCTOR = -1436617498; + public UpdateChatDraftMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (DraftMessage.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.draftMessage = new DraftMessage(input); + } + this.order = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.draftMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.draftMessage.serialize(output); + } + output.writeLong(this.order); + } } public static class UpdateChatOnlineMemberCount extends Update { public long chatId; public int onlineMemberCount; - public UpdateChatOnlineMemberCount() { - } + public static final int CONSTRUCTOR = 487369373; + + public UpdateChatOnlineMemberCount() {} public UpdateChatOnlineMemberCount(long chatId, int onlineMemberCount) { this.chatId = chatId; this.onlineMemberCount = onlineMemberCount; } - public static final int CONSTRUCTOR = 487369373; + public UpdateChatOnlineMemberCount(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.onlineMemberCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.onlineMemberCount); + } } public static class UpdateNotification extends Update { public int notificationGroupId; public Notification notification; - public UpdateNotification() { - } + public static final int CONSTRUCTOR = -1897496876; + + public UpdateNotification() {} public UpdateNotification(int notificationGroupId, Notification notification) { this.notificationGroupId = notificationGroupId; this.notification = notification; } - public static final int CONSTRUCTOR = -1897496876; + public UpdateNotification(DataInputStream input) throws IOException { + this.notificationGroupId = input.readInt(); + if (input.readBoolean()) { + if (Notification.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notification = new Notification(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.notificationGroupId); + if (this.notification == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.notification.serialize(output); + } + } } public static class UpdateNotificationGroup extends Update { @@ -13691,8 +35436,9 @@ public class TdApi { public Notification[] addedNotifications; public int[] removedNotificationIds; - public UpdateNotificationGroup() { - } + public static final int CONSTRUCTOR = -2049005665; + + public UpdateNotificationGroup() {} public UpdateNotificationGroup(int notificationGroupId, NotificationGroupType type, long chatId, long notificationSettingsChatId, boolean isSilent, int totalCount, Notification[] addedNotifications, int[] removedNotificationIds) { this.notificationGroupId = notificationGroupId; @@ -13705,50 +35451,132 @@ public class TdApi { this.removedNotificationIds = removedNotificationIds; } - public static final int CONSTRUCTOR = -2049005665; + public UpdateNotificationGroup(DataInputStream input) throws IOException { + this.notificationGroupId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationGroupTypeMessages.CONSTRUCTOR: + this.type = new NotificationGroupTypeMessages(input); + break; + case NotificationGroupTypeMentions.CONSTRUCTOR: + this.type = new NotificationGroupTypeMentions(input); + break; + case NotificationGroupTypeSecretChat.CONSTRUCTOR: + this.type = new NotificationGroupTypeSecretChat(input); + break; + case NotificationGroupTypeCalls.CONSTRUCTOR: + this.type = new NotificationGroupTypeCalls(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.chatId = input.readLong(); + this.notificationSettingsChatId = input.readLong(); + this.isSilent = input.readBoolean(); + this.totalCount = input.readInt(); + this.addedNotifications = new Notification[input.readInt()]; + for (int i = 0; i < this.addedNotifications.length; i++) { + if (Notification.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.addedNotifications[i] = new Notification(input); + } + this.removedNotificationIds = new int[input.readInt()]; + for (int i = 0; i < this.removedNotificationIds.length; i++) { + this.removedNotificationIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.notificationGroupId); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeLong(this.chatId); + output.writeLong(this.notificationSettingsChatId); + output.writeBoolean(this.isSilent); + output.writeInt(this.totalCount); + output.writeInt(this.addedNotifications.length); + for (int i = 0; i < this.addedNotifications.length; i++) { + this.addedNotifications[i].serialize(output); + } + output.writeInt(this.removedNotificationIds.length); + for (int i = 0; i < this.removedNotificationIds.length; i++) { + output.writeInt(this.removedNotificationIds[i]); + } + } } public static class UpdateActiveNotifications extends Update { public NotificationGroup[] groups; - public UpdateActiveNotifications() { - } + public static final int CONSTRUCTOR = -1306672221; + + public UpdateActiveNotifications() {} public UpdateActiveNotifications(NotificationGroup[] groups) { this.groups = groups; } - public static final int CONSTRUCTOR = -1306672221; + public UpdateActiveNotifications(DataInputStream input) throws IOException { + this.groups = new NotificationGroup[input.readInt()]; + for (int i = 0; i < this.groups.length; i++) { + if (NotificationGroup.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.groups[i] = new NotificationGroup(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.groups.length); + for (int i = 0; i < this.groups.length; i++) { + this.groups[i].serialize(output); + } + } } public static class UpdateHavePendingNotifications extends Update { public boolean haveDelayedNotifications; public boolean haveUnreceivedNotifications; - public UpdateHavePendingNotifications() { - } + public static final int CONSTRUCTOR = 179233243; + + public UpdateHavePendingNotifications() {} public UpdateHavePendingNotifications(boolean haveDelayedNotifications, boolean haveUnreceivedNotifications) { this.haveDelayedNotifications = haveDelayedNotifications; this.haveUnreceivedNotifications = haveUnreceivedNotifications; } - public static final int CONSTRUCTOR = 179233243; + public UpdateHavePendingNotifications(DataInputStream input) throws IOException { + this.haveDelayedNotifications = input.readBoolean(); + this.haveUnreceivedNotifications = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.haveDelayedNotifications); + output.writeBoolean(this.haveUnreceivedNotifications); + } } public static class UpdateDeleteMessages extends Update { @@ -13757,8 +35585,9 @@ public class TdApi { public boolean isPermanent; public boolean fromCache; - public UpdateDeleteMessages() { - } + public static final int CONSTRUCTOR = 1669252686; + + public UpdateDeleteMessages() {} public UpdateDeleteMessages(long chatId, long[] messageIds, boolean isPermanent, boolean fromCache) { this.chatId = chatId; @@ -13767,12 +35596,30 @@ public class TdApi { this.fromCache = fromCache; } - public static final int CONSTRUCTOR = 1669252686; + public UpdateDeleteMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + this.isPermanent = input.readBoolean(); + this.fromCache = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + output.writeBoolean(this.isPermanent); + output.writeBoolean(this.fromCache); + } } public static class UpdateUserChatAction extends Update { @@ -13780,8 +35627,9 @@ public class TdApi { public int userId; public ChatAction action; - public UpdateUserChatAction() { - } + public static final int CONSTRUCTOR = 1444133514; + + public UpdateUserChatAction() {} public UpdateUserChatAction(long chatId, int userId, ChatAction action) { this.chatId = chatId; @@ -13789,202 +35637,593 @@ public class TdApi { this.action = action; } - public static final int CONSTRUCTOR = 1444133514; + public UpdateUserChatAction(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatActionTyping.CONSTRUCTOR: + this.action = new ChatActionTyping(input); + break; + case ChatActionRecordingVideo.CONSTRUCTOR: + this.action = new ChatActionRecordingVideo(input); + break; + case ChatActionUploadingVideo.CONSTRUCTOR: + this.action = new ChatActionUploadingVideo(input); + break; + case ChatActionRecordingVoiceNote.CONSTRUCTOR: + this.action = new ChatActionRecordingVoiceNote(input); + break; + case ChatActionUploadingVoiceNote.CONSTRUCTOR: + this.action = new ChatActionUploadingVoiceNote(input); + break; + case ChatActionUploadingPhoto.CONSTRUCTOR: + this.action = new ChatActionUploadingPhoto(input); + break; + case ChatActionUploadingDocument.CONSTRUCTOR: + this.action = new ChatActionUploadingDocument(input); + break; + case ChatActionChoosingLocation.CONSTRUCTOR: + this.action = new ChatActionChoosingLocation(input); + break; + case ChatActionChoosingContact.CONSTRUCTOR: + this.action = new ChatActionChoosingContact(input); + break; + case ChatActionStartPlayingGame.CONSTRUCTOR: + this.action = new ChatActionStartPlayingGame(input); + break; + case ChatActionRecordingVideoNote.CONSTRUCTOR: + this.action = new ChatActionRecordingVideoNote(input); + break; + case ChatActionUploadingVideoNote.CONSTRUCTOR: + this.action = new ChatActionUploadingVideoNote(input); + break; + case ChatActionCancel.CONSTRUCTOR: + this.action = new ChatActionCancel(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userId); + if (this.action == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.action.serialize(output); + } + } } public static class UpdateUserStatus extends Update { public int userId; public UserStatus status; - public UpdateUserStatus() { - } + public static final int CONSTRUCTOR = -1443545195; + + public UpdateUserStatus() {} public UpdateUserStatus(int userId, UserStatus status) { this.userId = userId; this.status = status; } - public static final int CONSTRUCTOR = -1443545195; + public UpdateUserStatus(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case UserStatusEmpty.CONSTRUCTOR: + this.status = new UserStatusEmpty(input); + break; + case UserStatusOnline.CONSTRUCTOR: + this.status = new UserStatusOnline(input); + break; + case UserStatusOffline.CONSTRUCTOR: + this.status = new UserStatusOffline(input); + break; + case UserStatusRecently.CONSTRUCTOR: + this.status = new UserStatusRecently(input); + break; + case UserStatusLastWeek.CONSTRUCTOR: + this.status = new UserStatusLastWeek(input); + break; + case UserStatusLastMonth.CONSTRUCTOR: + this.status = new UserStatusLastMonth(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + } } public static class UpdateUser extends Update { public User user; - public UpdateUser() { - } + public static final int CONSTRUCTOR = 1183394041; + + public UpdateUser() {} public UpdateUser(User user) { this.user = user; } - public static final int CONSTRUCTOR = 1183394041; + public UpdateUser(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (User.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.user = new User(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.user == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.user.serialize(output); + } + } } public static class UpdateBasicGroup extends Update { public BasicGroup basicGroup; - public UpdateBasicGroup() { - } + public static final int CONSTRUCTOR = -1003239581; + + public UpdateBasicGroup() {} public UpdateBasicGroup(BasicGroup basicGroup) { this.basicGroup = basicGroup; } - public static final int CONSTRUCTOR = -1003239581; + public UpdateBasicGroup(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (BasicGroup.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.basicGroup = new BasicGroup(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.basicGroup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.basicGroup.serialize(output); + } + } } public static class UpdateSupergroup extends Update { public Supergroup supergroup; - public UpdateSupergroup() { - } + public static final int CONSTRUCTOR = -76782300; + + public UpdateSupergroup() {} public UpdateSupergroup(Supergroup supergroup) { this.supergroup = supergroup; } - public static final int CONSTRUCTOR = -76782300; + public UpdateSupergroup(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Supergroup.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.supergroup = new Supergroup(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.supergroup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.supergroup.serialize(output); + } + } } public static class UpdateSecretChat extends Update { public SecretChat secretChat; - public UpdateSecretChat() { - } + public static final int CONSTRUCTOR = -1666903253; + + public UpdateSecretChat() {} public UpdateSecretChat(SecretChat secretChat) { this.secretChat = secretChat; } - public static final int CONSTRUCTOR = -1666903253; + public UpdateSecretChat(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (SecretChat.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.secretChat = new SecretChat(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.secretChat == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.secretChat.serialize(output); + } + } } public static class UpdateUserFullInfo extends Update { public int userId; public UserFullInfo userFullInfo; - public UpdateUserFullInfo() { - } + public static final int CONSTRUCTOR = 222103874; + + public UpdateUserFullInfo() {} public UpdateUserFullInfo(int userId, UserFullInfo userFullInfo) { this.userId = userId; this.userFullInfo = userFullInfo; } - public static final int CONSTRUCTOR = 222103874; + public UpdateUserFullInfo(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + if (UserFullInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.userFullInfo = new UserFullInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.userFullInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.userFullInfo.serialize(output); + } + } } public static class UpdateBasicGroupFullInfo extends Update { public int basicGroupId; public BasicGroupFullInfo basicGroupFullInfo; - public UpdateBasicGroupFullInfo() { - } + public static final int CONSTRUCTOR = 924030531; + + public UpdateBasicGroupFullInfo() {} public UpdateBasicGroupFullInfo(int basicGroupId, BasicGroupFullInfo basicGroupFullInfo) { this.basicGroupId = basicGroupId; this.basicGroupFullInfo = basicGroupFullInfo; } - public static final int CONSTRUCTOR = 924030531; + public UpdateBasicGroupFullInfo(DataInputStream input) throws IOException { + this.basicGroupId = input.readInt(); + if (input.readBoolean()) { + if (BasicGroupFullInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.basicGroupFullInfo = new BasicGroupFullInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.basicGroupId); + if (this.basicGroupFullInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.basicGroupFullInfo.serialize(output); + } + } } public static class UpdateSupergroupFullInfo extends Update { public int supergroupId; public SupergroupFullInfo supergroupFullInfo; - public UpdateSupergroupFullInfo() { - } + public static final int CONSTRUCTOR = 1288828758; + + public UpdateSupergroupFullInfo() {} public UpdateSupergroupFullInfo(int supergroupId, SupergroupFullInfo supergroupFullInfo) { this.supergroupId = supergroupId; this.supergroupFullInfo = supergroupFullInfo; } - public static final int CONSTRUCTOR = 1288828758; + public UpdateSupergroupFullInfo(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + if (input.readBoolean()) { + if (SupergroupFullInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.supergroupFullInfo = new SupergroupFullInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + if (this.supergroupFullInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.supergroupFullInfo.serialize(output); + } + } } public static class UpdateServiceNotification extends Update { public String type; public MessageContent content; - public UpdateServiceNotification() { - } + public static final int CONSTRUCTOR = 1318622637; + + public UpdateServiceNotification() {} public UpdateServiceNotification(String type, MessageContent content) { this.type = type; this.content = content; } - public static final int CONSTRUCTOR = 1318622637; + public UpdateServiceNotification(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var typeTmp = new byte[input.readInt()]; + input.readFully(typeTmp); + this.type = new String(typeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageText.CONSTRUCTOR: + this.content = new MessageText(input); + break; + case MessageAnimation.CONSTRUCTOR: + this.content = new MessageAnimation(input); + break; + case MessageAudio.CONSTRUCTOR: + this.content = new MessageAudio(input); + break; + case MessageDocument.CONSTRUCTOR: + this.content = new MessageDocument(input); + break; + case MessagePhoto.CONSTRUCTOR: + this.content = new MessagePhoto(input); + break; + case MessageExpiredPhoto.CONSTRUCTOR: + this.content = new MessageExpiredPhoto(input); + break; + case MessageSticker.CONSTRUCTOR: + this.content = new MessageSticker(input); + break; + case MessageVideo.CONSTRUCTOR: + this.content = new MessageVideo(input); + break; + case MessageExpiredVideo.CONSTRUCTOR: + this.content = new MessageExpiredVideo(input); + break; + case MessageVideoNote.CONSTRUCTOR: + this.content = new MessageVideoNote(input); + break; + case MessageVoiceNote.CONSTRUCTOR: + this.content = new MessageVoiceNote(input); + break; + case MessageLocation.CONSTRUCTOR: + this.content = new MessageLocation(input); + break; + case MessageVenue.CONSTRUCTOR: + this.content = new MessageVenue(input); + break; + case MessageContact.CONSTRUCTOR: + this.content = new MessageContact(input); + break; + case MessageDice.CONSTRUCTOR: + this.content = new MessageDice(input); + break; + case MessageGame.CONSTRUCTOR: + this.content = new MessageGame(input); + break; + case MessagePoll.CONSTRUCTOR: + this.content = new MessagePoll(input); + break; + case MessageInvoice.CONSTRUCTOR: + this.content = new MessageInvoice(input); + break; + case MessageCall.CONSTRUCTOR: + this.content = new MessageCall(input); + break; + case MessageBasicGroupChatCreate.CONSTRUCTOR: + this.content = new MessageBasicGroupChatCreate(input); + break; + case MessageSupergroupChatCreate.CONSTRUCTOR: + this.content = new MessageSupergroupChatCreate(input); + break; + case MessageChatChangeTitle.CONSTRUCTOR: + this.content = new MessageChatChangeTitle(input); + break; + case MessageChatChangePhoto.CONSTRUCTOR: + this.content = new MessageChatChangePhoto(input); + break; + case MessageChatDeletePhoto.CONSTRUCTOR: + this.content = new MessageChatDeletePhoto(input); + break; + case MessageChatAddMembers.CONSTRUCTOR: + this.content = new MessageChatAddMembers(input); + break; + case MessageChatJoinByLink.CONSTRUCTOR: + this.content = new MessageChatJoinByLink(input); + break; + case MessageChatDeleteMember.CONSTRUCTOR: + this.content = new MessageChatDeleteMember(input); + break; + case MessageChatUpgradeTo.CONSTRUCTOR: + this.content = new MessageChatUpgradeTo(input); + break; + case MessageChatUpgradeFrom.CONSTRUCTOR: + this.content = new MessageChatUpgradeFrom(input); + break; + case MessagePinMessage.CONSTRUCTOR: + this.content = new MessagePinMessage(input); + break; + case MessageScreenshotTaken.CONSTRUCTOR: + this.content = new MessageScreenshotTaken(input); + break; + case MessageChatSetTtl.CONSTRUCTOR: + this.content = new MessageChatSetTtl(input); + break; + case MessageCustomServiceAction.CONSTRUCTOR: + this.content = new MessageCustomServiceAction(input); + break; + case MessageGameScore.CONSTRUCTOR: + this.content = new MessageGameScore(input); + break; + case MessagePaymentSuccessful.CONSTRUCTOR: + this.content = new MessagePaymentSuccessful(input); + break; + case MessagePaymentSuccessfulBot.CONSTRUCTOR: + this.content = new MessagePaymentSuccessfulBot(input); + break; + case MessageContactRegistered.CONSTRUCTOR: + this.content = new MessageContactRegistered(input); + break; + case MessageWebsiteConnected.CONSTRUCTOR: + this.content = new MessageWebsiteConnected(input); + break; + case MessagePassportDataSent.CONSTRUCTOR: + this.content = new MessagePassportDataSent(input); + break; + case MessagePassportDataReceived.CONSTRUCTOR: + this.content = new MessagePassportDataReceived(input); + break; + case MessageUnsupported.CONSTRUCTOR: + this.content = new MessageUnsupported(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var typeTmp = this.type.getBytes(StandardCharsets.UTF_8); + output.writeInt(typeTmp.length); + output.write(typeTmp); + } + if (this.content == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.content.serialize(output); + } + } } public static class UpdateFile extends Update { public File file; - public UpdateFile() { - } + public static final int CONSTRUCTOR = 114132831; + + public UpdateFile() {} public UpdateFile(File file) { this.file = file; } - public static final int CONSTRUCTOR = 114132831; + public UpdateFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.file = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.file == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.file.serialize(output); + } + } } public static class UpdateFileGenerationStart extends Update { @@ -13993,8 +36232,9 @@ public class TdApi { public String destinationPath; public String conversion; - public UpdateFileGenerationStart() { - } + public static final int CONSTRUCTOR = 216817388; + + public UpdateFileGenerationStart() {} public UpdateFileGenerationStart(long generationId, String originalPath, String destinationPath, String conversion) { this.generationId = generationId; @@ -14003,68 +36243,190 @@ public class TdApi { this.conversion = conversion; } - public static final int CONSTRUCTOR = 216817388; + public UpdateFileGenerationStart(DataInputStream input) throws IOException { + this.generationId = input.readLong(); + if (input.readBoolean()) { + var originalPathTmp = new byte[input.readInt()]; + input.readFully(originalPathTmp); + this.originalPath = new String(originalPathTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var destinationPathTmp = new byte[input.readInt()]; + input.readFully(destinationPathTmp); + this.destinationPath = new String(destinationPathTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var conversionTmp = new byte[input.readInt()]; + input.readFully(conversionTmp); + this.conversion = new String(conversionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.generationId); + if (this.originalPath == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var originalPathTmp = this.originalPath.getBytes(StandardCharsets.UTF_8); + output.writeInt(originalPathTmp.length); + output.write(originalPathTmp); + } + if (this.destinationPath == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var destinationPathTmp = this.destinationPath.getBytes(StandardCharsets.UTF_8); + output.writeInt(destinationPathTmp.length); + output.write(destinationPathTmp); + } + if (this.conversion == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var conversionTmp = this.conversion.getBytes(StandardCharsets.UTF_8); + output.writeInt(conversionTmp.length); + output.write(conversionTmp); + } + } } public static class UpdateFileGenerationStop extends Update { public long generationId; - public UpdateFileGenerationStop() { - } + public static final int CONSTRUCTOR = -1894449685; + + public UpdateFileGenerationStop() {} public UpdateFileGenerationStop(long generationId) { this.generationId = generationId; } - public static final int CONSTRUCTOR = -1894449685; + public UpdateFileGenerationStop(DataInputStream input) throws IOException { + this.generationId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.generationId); + } } public static class UpdateCall extends Update { public Call call; - public UpdateCall() { - } + public static final int CONSTRUCTOR = 1337184477; + + public UpdateCall() {} public UpdateCall(Call call) { this.call = call; } - public static final int CONSTRUCTOR = 1337184477; + public UpdateCall(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Call.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.call = new Call(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.call == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.call.serialize(output); + } + } } public static class UpdateUserPrivacySettingRules extends Update { public UserPrivacySetting setting; public UserPrivacySettingRules rules; - public UpdateUserPrivacySettingRules() { - } + public static final int CONSTRUCTOR = -912960778; + + public UpdateUserPrivacySettingRules() {} public UpdateUserPrivacySettingRules(UserPrivacySetting setting, UserPrivacySettingRules rules) { this.setting = setting; this.rules = rules; } - public static final int CONSTRUCTOR = -912960778; + public UpdateUserPrivacySettingRules(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case UserPrivacySettingShowStatus.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowStatus(input); + break; + case UserPrivacySettingShowProfilePhoto.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowProfilePhoto(input); + break; + case UserPrivacySettingShowLinkInForwardedMessages.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowLinkInForwardedMessages(input); + break; + case UserPrivacySettingShowPhoneNumber.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowPhoneNumber(input); + break; + case UserPrivacySettingAllowChatInvites.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowChatInvites(input); + break; + case UserPrivacySettingAllowCalls.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowCalls(input); + break; + case UserPrivacySettingAllowPeerToPeerCalls.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowPeerToPeerCalls(input); + break; + case UserPrivacySettingAllowFindingByPhoneNumber.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowFindingByPhoneNumber(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (UserPrivacySettingRules.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.rules = new UserPrivacySettingRules(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.setting == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.setting.serialize(output); + } + if (this.rules == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.rules.serialize(output); + } + } } public static class UpdateUnreadMessageCount extends Update { @@ -14072,8 +36434,9 @@ public class TdApi { public int unreadCount; public int unreadUnmutedCount; - public UpdateUnreadMessageCount() { - } + public static final int CONSTRUCTOR = 78987721; + + public UpdateUnreadMessageCount() {} public UpdateUnreadMessageCount(ChatList chatList, int unreadCount, int unreadUnmutedCount) { this.chatList = chatList; @@ -14081,12 +36444,38 @@ public class TdApi { this.unreadUnmutedCount = unreadUnmutedCount; } - public static final int CONSTRUCTOR = 78987721; + public UpdateUnreadMessageCount(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.unreadCount = input.readInt(); + this.unreadUnmutedCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + output.writeInt(this.unreadCount); + output.writeInt(this.unreadUnmutedCount); + } } public static class UpdateUnreadChatCount extends Update { @@ -14097,8 +36486,9 @@ public class TdApi { public int markedAsUnreadCount; public int markedAsUnreadUnmutedCount; - public UpdateUnreadChatCount() { - } + public static final int CONSTRUCTOR = 1994494530; + + public UpdateUnreadChatCount() {} public UpdateUnreadChatCount(ChatList chatList, int totalCount, int unreadCount, int unreadUnmutedCount, int markedAsUnreadCount, int markedAsUnreadUnmutedCount) { this.chatList = chatList; @@ -14109,164 +36499,347 @@ public class TdApi { this.markedAsUnreadUnmutedCount = markedAsUnreadUnmutedCount; } - public static final int CONSTRUCTOR = 1994494530; + public UpdateUnreadChatCount(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.totalCount = input.readInt(); + this.unreadCount = input.readInt(); + this.unreadUnmutedCount = input.readInt(); + this.markedAsUnreadCount = input.readInt(); + this.markedAsUnreadUnmutedCount = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + output.writeInt(this.totalCount); + output.writeInt(this.unreadCount); + output.writeInt(this.unreadUnmutedCount); + output.writeInt(this.markedAsUnreadCount); + output.writeInt(this.markedAsUnreadUnmutedCount); + } } public static class UpdateOption extends Update { public String name; public OptionValue value; - public UpdateOption() { - } + public static final int CONSTRUCTOR = 900822020; + + public UpdateOption() {} public UpdateOption(String name, OptionValue value) { this.name = name; this.value = value; } - public static final int CONSTRUCTOR = 900822020; + public UpdateOption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case OptionValueBoolean.CONSTRUCTOR: + this.value = new OptionValueBoolean(input); + break; + case OptionValueEmpty.CONSTRUCTOR: + this.value = new OptionValueEmpty(input); + break; + case OptionValueInteger.CONSTRUCTOR: + this.value = new OptionValueInteger(input); + break; + case OptionValueString.CONSTRUCTOR: + this.value = new OptionValueString(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.value.serialize(output); + } + } } public static class UpdateStickerSet extends Update { public StickerSet stickerSet; - public UpdateStickerSet() { - } + public static final int CONSTRUCTOR = 1879268812; + + public UpdateStickerSet() {} public UpdateStickerSet(StickerSet stickerSet) { this.stickerSet = stickerSet; } - public static final int CONSTRUCTOR = 1879268812; + public UpdateStickerSet(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (StickerSet.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.stickerSet = new StickerSet(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.stickerSet == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.stickerSet.serialize(output); + } + } } public static class UpdateInstalledStickerSets extends Update { public boolean isMasks; public long[] stickerSetIds; - public UpdateInstalledStickerSets() { - } + public static final int CONSTRUCTOR = 1125575977; + + public UpdateInstalledStickerSets() {} public UpdateInstalledStickerSets(boolean isMasks, long[] stickerSetIds) { this.isMasks = isMasks; this.stickerSetIds = stickerSetIds; } - public static final int CONSTRUCTOR = 1125575977; + public UpdateInstalledStickerSets(DataInputStream input) throws IOException { + this.isMasks = input.readBoolean(); + this.stickerSetIds = new long[input.readInt()]; + for (int i = 0; i < this.stickerSetIds.length; i++) { + this.stickerSetIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isMasks); + output.writeInt(this.stickerSetIds.length); + for (int i = 0; i < this.stickerSetIds.length; i++) { + output.writeLong(this.stickerSetIds[i]); + } + } } public static class UpdateTrendingStickerSets extends Update { public StickerSets stickerSets; - public UpdateTrendingStickerSets() { - } + public static final int CONSTRUCTOR = 450714593; + + public UpdateTrendingStickerSets() {} public UpdateTrendingStickerSets(StickerSets stickerSets) { this.stickerSets = stickerSets; } - public static final int CONSTRUCTOR = 450714593; + public UpdateTrendingStickerSets(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (StickerSets.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.stickerSets = new StickerSets(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.stickerSets == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.stickerSets.serialize(output); + } + } } public static class UpdateRecentStickers extends Update { public boolean isAttached; public int[] stickerIds; - public UpdateRecentStickers() { - } + public static final int CONSTRUCTOR = 1906403540; + + public UpdateRecentStickers() {} public UpdateRecentStickers(boolean isAttached, int[] stickerIds) { this.isAttached = isAttached; this.stickerIds = stickerIds; } - public static final int CONSTRUCTOR = 1906403540; + public UpdateRecentStickers(DataInputStream input) throws IOException { + this.isAttached = input.readBoolean(); + this.stickerIds = new int[input.readInt()]; + for (int i = 0; i < this.stickerIds.length; i++) { + this.stickerIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAttached); + output.writeInt(this.stickerIds.length); + for (int i = 0; i < this.stickerIds.length; i++) { + output.writeInt(this.stickerIds[i]); + } + } } public static class UpdateFavoriteStickers extends Update { public int[] stickerIds; - public UpdateFavoriteStickers() { - } + public static final int CONSTRUCTOR = 1662240999; + + public UpdateFavoriteStickers() {} public UpdateFavoriteStickers(int[] stickerIds) { this.stickerIds = stickerIds; } - public static final int CONSTRUCTOR = 1662240999; + public UpdateFavoriteStickers(DataInputStream input) throws IOException { + this.stickerIds = new int[input.readInt()]; + for (int i = 0; i < this.stickerIds.length; i++) { + this.stickerIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.stickerIds.length); + for (int i = 0; i < this.stickerIds.length; i++) { + output.writeInt(this.stickerIds[i]); + } + } } public static class UpdateSavedAnimations extends Update { public int[] animationIds; - public UpdateSavedAnimations() { - } + public static final int CONSTRUCTOR = 65563814; + + public UpdateSavedAnimations() {} public UpdateSavedAnimations(int[] animationIds) { this.animationIds = animationIds; } - public static final int CONSTRUCTOR = 65563814; + public UpdateSavedAnimations(DataInputStream input) throws IOException { + this.animationIds = new int[input.readInt()]; + for (int i = 0; i < this.animationIds.length; i++) { + this.animationIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.animationIds.length); + for (int i = 0; i < this.animationIds.length; i++) { + output.writeInt(this.animationIds[i]); + } + } } public static class UpdateSelectedBackground extends Update { public boolean forDarkTheme; public Background background; - public UpdateSelectedBackground() { - } + public static final int CONSTRUCTOR = -1715658659; + + public UpdateSelectedBackground() {} public UpdateSelectedBackground(boolean forDarkTheme, Background background) { this.forDarkTheme = forDarkTheme; this.background = background; } - public static final int CONSTRUCTOR = -1715658659; + public UpdateSelectedBackground(DataInputStream input) throws IOException { + this.forDarkTheme = input.readBoolean(); + if (input.readBoolean()) { + if (Background.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.background = new Background(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.forDarkTheme); + if (this.background == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.background.serialize(output); + } + } } public static class UpdateLanguagePackStrings extends Update { @@ -14274,8 +36847,9 @@ public class TdApi { public String languagePackId; public LanguagePackString[] strings; - public UpdateLanguagePackStrings() { - } + public static final int CONSTRUCTOR = -1056319886; + + public UpdateLanguagePackStrings() {} public UpdateLanguagePackStrings(String localizationTarget, String languagePackId, LanguagePackString[] strings) { this.localizationTarget = localizationTarget; @@ -14283,86 +36857,222 @@ public class TdApi { this.strings = strings; } - public static final int CONSTRUCTOR = -1056319886; + public UpdateLanguagePackStrings(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var localizationTargetTmp = new byte[input.readInt()]; + input.readFully(localizationTargetTmp); + this.localizationTarget = new String(localizationTargetTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + this.strings = new LanguagePackString[input.readInt()]; + for (int i = 0; i < this.strings.length; i++) { + if (LanguagePackString.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.strings[i] = new LanguagePackString(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.localizationTarget == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var localizationTargetTmp = this.localizationTarget.getBytes(StandardCharsets.UTF_8); + output.writeInt(localizationTargetTmp.length); + output.write(localizationTargetTmp); + } + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + output.writeInt(this.strings.length); + for (int i = 0; i < this.strings.length; i++) { + this.strings[i].serialize(output); + } + } } public static class UpdateConnectionState extends Update { public ConnectionState state; - public UpdateConnectionState() { - } + public static final int CONSTRUCTOR = 1469292078; + + public UpdateConnectionState() {} public UpdateConnectionState(ConnectionState state) { this.state = state; } - public static final int CONSTRUCTOR = 1469292078; + public UpdateConnectionState(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case ConnectionStateWaitingForNetwork.CONSTRUCTOR: + this.state = new ConnectionStateWaitingForNetwork(input); + break; + case ConnectionStateConnectingToProxy.CONSTRUCTOR: + this.state = new ConnectionStateConnectingToProxy(input); + break; + case ConnectionStateConnecting.CONSTRUCTOR: + this.state = new ConnectionStateConnecting(input); + break; + case ConnectionStateUpdating.CONSTRUCTOR: + this.state = new ConnectionStateUpdating(input); + break; + case ConnectionStateReady.CONSTRUCTOR: + this.state = new ConnectionStateReady(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.state == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.state.serialize(output); + } + } } public static class UpdateTermsOfService extends Update { public String termsOfServiceId; public TermsOfService termsOfService; - public UpdateTermsOfService() { - } + public static final int CONSTRUCTOR = -1304640162; + + public UpdateTermsOfService() {} public UpdateTermsOfService(String termsOfServiceId, TermsOfService termsOfService) { this.termsOfServiceId = termsOfServiceId; this.termsOfService = termsOfService; } - public static final int CONSTRUCTOR = -1304640162; + public UpdateTermsOfService(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var termsOfServiceIdTmp = new byte[input.readInt()]; + input.readFully(termsOfServiceIdTmp); + this.termsOfServiceId = new String(termsOfServiceIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (TermsOfService.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.termsOfService = new TermsOfService(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.termsOfServiceId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var termsOfServiceIdTmp = this.termsOfServiceId.getBytes(StandardCharsets.UTF_8); + output.writeInt(termsOfServiceIdTmp.length); + output.write(termsOfServiceIdTmp); + } + if (this.termsOfService == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.termsOfService.serialize(output); + } + } } public static class UpdateUsersNearby extends Update { public ChatNearby[] usersNearby; - public UpdateUsersNearby() { - } + public static final int CONSTRUCTOR = -1517109163; + + public UpdateUsersNearby() {} public UpdateUsersNearby(ChatNearby[] usersNearby) { this.usersNearby = usersNearby; } - public static final int CONSTRUCTOR = -1517109163; + public UpdateUsersNearby(DataInputStream input) throws IOException { + this.usersNearby = new ChatNearby[input.readInt()]; + for (int i = 0; i < this.usersNearby.length; i++) { + if (ChatNearby.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.usersNearby[i] = new ChatNearby(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.usersNearby.length); + for (int i = 0; i < this.usersNearby.length; i++) { + this.usersNearby[i].serialize(output); + } + } } public static class UpdateDiceEmojis extends Update { public String[] emojis; - public UpdateDiceEmojis() { - } + public static final int CONSTRUCTOR = -1069066940; + + public UpdateDiceEmojis() {} public UpdateDiceEmojis(String[] emojis) { this.emojis = emojis; } - public static final int CONSTRUCTOR = -1069066940; + public UpdateDiceEmojis(DataInputStream input) throws IOException { + this.emojis = new String[input.readInt()]; + for (int i = 0; i < this.emojis.length; i++) { + var emojisTmp = new byte[input.readInt()]; + input.readFully(emojisTmp); + this.emojis[i] = new String(emojisTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.emojis.length); + for (int i = 0; i < this.emojis.length; i++) { + var emojisTmp = this.emojis[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(emojisTmp.length); + output.write(emojisTmp); + } + } } public static class UpdateNewInlineQuery extends Update { @@ -14372,8 +37082,9 @@ public class TdApi { public String query; public String offset; - public UpdateNewInlineQuery() { - } + public static final int CONSTRUCTOR = 2064730634; + + public UpdateNewInlineQuery() {} public UpdateNewInlineQuery(long id, int senderUserId, Location userLocation, String query, String offset) { this.id = id; @@ -14383,12 +37094,58 @@ public class TdApi { this.offset = offset; } - public static final int CONSTRUCTOR = 2064730634; + public UpdateNewInlineQuery(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.senderUserId = input.readInt(); + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.userLocation = new Location(input); + } + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var offsetTmp = new byte[input.readInt()]; + input.readFully(offsetTmp); + this.offset = new String(offsetTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.senderUserId); + if (this.userLocation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.userLocation.serialize(output); + } + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + if (this.offset == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var offsetTmp = this.offset.getBytes(StandardCharsets.UTF_8); + output.writeInt(offsetTmp.length); + output.write(offsetTmp); + } + } } public static class UpdateNewChosenInlineResult extends Update { @@ -14398,8 +37155,9 @@ public class TdApi { public String resultId; public String inlineMessageId; - public UpdateNewChosenInlineResult() { - } + public static final int CONSTRUCTOR = 527526965; + + public UpdateNewChosenInlineResult() {} public UpdateNewChosenInlineResult(int senderUserId, Location userLocation, String query, String resultId, String inlineMessageId) { this.senderUserId = senderUserId; @@ -14409,12 +37167,69 @@ public class TdApi { this.inlineMessageId = inlineMessageId; } - public static final int CONSTRUCTOR = 527526965; + public UpdateNewChosenInlineResult(DataInputStream input) throws IOException { + this.senderUserId = input.readInt(); + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.userLocation = new Location(input); + } + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var resultIdTmp = new byte[input.readInt()]; + input.readFully(resultIdTmp); + this.resultId = new String(resultIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.senderUserId); + if (this.userLocation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.userLocation.serialize(output); + } + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + if (this.resultId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var resultIdTmp = this.resultId.getBytes(StandardCharsets.UTF_8); + output.writeInt(resultIdTmp.length); + output.write(resultIdTmp); + } + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + } } public static class UpdateNewCallbackQuery extends Update { @@ -14425,8 +37240,9 @@ public class TdApi { public long chatInstance; public CallbackQueryPayload payload; - public UpdateNewCallbackQuery() { - } + public static final int CONSTRUCTOR = -2044226370; + + public UpdateNewCallbackQuery() {} public UpdateNewCallbackQuery(long id, int senderUserId, long chatId, long messageId, long chatInstance, CallbackQueryPayload payload) { this.id = id; @@ -14437,12 +37253,44 @@ public class TdApi { this.payload = payload; } - public static final int CONSTRUCTOR = -2044226370; + public UpdateNewCallbackQuery(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.senderUserId = input.readInt(); + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.chatInstance = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case CallbackQueryPayloadData.CONSTRUCTOR: + this.payload = new CallbackQueryPayloadData(input); + break; + case CallbackQueryPayloadGame.CONSTRUCTOR: + this.payload = new CallbackQueryPayloadGame(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.senderUserId); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeLong(this.chatInstance); + if (this.payload == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.payload.serialize(output); + } + } } public static class UpdateNewInlineCallbackQuery extends Update { @@ -14452,8 +37300,9 @@ public class TdApi { public long chatInstance; public CallbackQueryPayload payload; - public UpdateNewInlineCallbackQuery() { - } + public static final int CONSTRUCTOR = -1879154829; + + public UpdateNewInlineCallbackQuery() {} public UpdateNewInlineCallbackQuery(long id, int senderUserId, String inlineMessageId, long chatInstance, CallbackQueryPayload payload) { this.id = id; @@ -14463,12 +37312,53 @@ public class TdApi { this.payload = payload; } - public static final int CONSTRUCTOR = -1879154829; + public UpdateNewInlineCallbackQuery(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.senderUserId = input.readInt(); + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + this.chatInstance = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case CallbackQueryPayloadData.CONSTRUCTOR: + this.payload = new CallbackQueryPayloadData(input); + break; + case CallbackQueryPayloadGame.CONSTRUCTOR: + this.payload = new CallbackQueryPayloadGame(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.senderUserId); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + output.writeLong(this.chatInstance); + if (this.payload == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.payload.serialize(output); + } + } } public static class UpdateNewShippingQuery extends Update { @@ -14477,8 +37367,9 @@ public class TdApi { public String invoicePayload; public Address shippingAddress; - public UpdateNewShippingQuery() { - } + public static final int CONSTRUCTOR = -817474682; + + public UpdateNewShippingQuery() {} public UpdateNewShippingQuery(long id, int senderUserId, String invoicePayload, Address shippingAddress) { this.id = id; @@ -14487,12 +37378,45 @@ public class TdApi { this.shippingAddress = shippingAddress; } - public static final int CONSTRUCTOR = -817474682; + public UpdateNewShippingQuery(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.senderUserId = input.readInt(); + if (input.readBoolean()) { + var invoicePayloadTmp = new byte[input.readInt()]; + input.readFully(invoicePayloadTmp); + this.invoicePayload = new String(invoicePayloadTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Address.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.shippingAddress = new Address(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.senderUserId); + if (this.invoicePayload == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var invoicePayloadTmp = this.invoicePayload.getBytes(StandardCharsets.UTF_8); + output.writeInt(invoicePayloadTmp.length); + output.write(invoicePayloadTmp); + } + if (this.shippingAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.shippingAddress.serialize(output); + } + } } public static class UpdateNewPreCheckoutQuery extends Update { @@ -14504,8 +37428,9 @@ public class TdApi { public String shippingOptionId; public OrderInfo orderInfo; - public UpdateNewPreCheckoutQuery() { - } + public static final int CONSTRUCTOR = 87964006; + + public UpdateNewPreCheckoutQuery() {} public UpdateNewPreCheckoutQuery(long id, int senderUserId, String currency, long totalAmount, byte[] invoicePayload, String shippingOptionId, OrderInfo orderInfo) { this.id = id; @@ -14517,30 +37442,100 @@ public class TdApi { this.orderInfo = orderInfo; } - public static final int CONSTRUCTOR = 87964006; + public UpdateNewPreCheckoutQuery(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.senderUserId = input.readInt(); + if (input.readBoolean()) { + var currencyTmp = new byte[input.readInt()]; + input.readFully(currencyTmp); + this.currency = new String(currencyTmp, StandardCharsets.UTF_8); + } + this.totalAmount = input.readLong(); + this.invoicePayload = new byte[input.readInt()]; + input.readFully(this.invoicePayload); + if (input.readBoolean()) { + var shippingOptionIdTmp = new byte[input.readInt()]; + input.readFully(shippingOptionIdTmp); + this.shippingOptionId = new String(shippingOptionIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (OrderInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.orderInfo = new OrderInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.senderUserId); + if (this.currency == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var currencyTmp = this.currency.getBytes(StandardCharsets.UTF_8); + output.writeInt(currencyTmp.length); + output.write(currencyTmp); + } + output.writeLong(this.totalAmount); + output.writeInt(this.invoicePayload.length); + output.write(this.invoicePayload); + if (this.shippingOptionId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var shippingOptionIdTmp = this.shippingOptionId.getBytes(StandardCharsets.UTF_8); + output.writeInt(shippingOptionIdTmp.length); + output.write(shippingOptionIdTmp); + } + if (this.orderInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.orderInfo.serialize(output); + } + } } public static class UpdateNewCustomEvent extends Update { public String event; - public UpdateNewCustomEvent() { - } + public static final int CONSTRUCTOR = 1994222092; + + public UpdateNewCustomEvent() {} public UpdateNewCustomEvent(String event) { this.event = event; } - public static final int CONSTRUCTOR = 1994222092; + public UpdateNewCustomEvent(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var eventTmp = new byte[input.readInt()]; + input.readFully(eventTmp); + this.event = new String(eventTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.event == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var eventTmp = this.event.getBytes(StandardCharsets.UTF_8); + output.writeInt(eventTmp.length); + output.write(eventTmp); + } + } } public static class UpdateNewCustomQuery extends Update { @@ -14548,8 +37543,9 @@ public class TdApi { public String data; public int timeout; - public UpdateNewCustomQuery() { - } + public static final int CONSTRUCTOR = -687670874; + + public UpdateNewCustomQuery() {} public UpdateNewCustomQuery(long id, String data, int timeout) { this.id = id; @@ -14557,30 +37553,68 @@ public class TdApi { this.timeout = timeout; } - public static final int CONSTRUCTOR = -687670874; + public UpdateNewCustomQuery(DataInputStream input) throws IOException { + this.id = input.readLong(); + if (input.readBoolean()) { + var dataTmp = new byte[input.readInt()]; + input.readFully(dataTmp); + this.data = new String(dataTmp, StandardCharsets.UTF_8); + } + this.timeout = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + if (this.data == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var dataTmp = this.data.getBytes(StandardCharsets.UTF_8); + output.writeInt(dataTmp.length); + output.write(dataTmp); + } + output.writeInt(this.timeout); + } } public static class UpdatePoll extends Update { public Poll poll; - public UpdatePoll() { - } + public static final int CONSTRUCTOR = -1771342902; + + public UpdatePoll() {} public UpdatePoll(Poll poll) { this.poll = poll; } - public static final int CONSTRUCTOR = -1771342902; + public UpdatePoll(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Poll.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.poll = new Poll(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.poll == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.poll.serialize(output); + } + } } public static class UpdatePollAnswer extends Update { @@ -14588,8 +37622,9 @@ public class TdApi { public int userId; public int[] optionIds; - public UpdatePollAnswer() { - } + public static final int CONSTRUCTOR = 1606139344; + + public UpdatePollAnswer() {} public UpdatePollAnswer(long pollId, int userId, int[] optionIds) { this.pollId = pollId; @@ -14597,30 +37632,296 @@ public class TdApi { this.optionIds = optionIds; } - public static final int CONSTRUCTOR = 1606139344; + public UpdatePollAnswer(DataInputStream input) throws IOException { + this.pollId = input.readLong(); + this.userId = input.readInt(); + this.optionIds = new int[input.readInt()]; + for (int i = 0; i < this.optionIds.length; i++) { + this.optionIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.pollId); + output.writeInt(this.userId); + output.writeInt(this.optionIds.length); + for (int i = 0; i < this.optionIds.length; i++) { + output.writeInt(this.optionIds[i]); + } + } } public static class Updates extends Object { public Update[] updates; - public Updates() { - } + public static final int CONSTRUCTOR = 475842347; + + public Updates() {} public Updates(Update[] updates) { this.updates = updates; } - public static final int CONSTRUCTOR = 475842347; + public Updates(DataInputStream input) throws IOException { + this.updates = new Update[input.readInt()]; + for (int i = 0; i < this.updates.length; i++) { + switch(input.readInt()) { + case UpdateAuthorizationState.CONSTRUCTOR: + this.updates[i] = new UpdateAuthorizationState(input); + break; + case UpdateNewMessage.CONSTRUCTOR: + this.updates[i] = new UpdateNewMessage(input); + break; + case UpdateMessageSendAcknowledged.CONSTRUCTOR: + this.updates[i] = new UpdateMessageSendAcknowledged(input); + break; + case UpdateMessageSendSucceeded.CONSTRUCTOR: + this.updates[i] = new UpdateMessageSendSucceeded(input); + break; + case UpdateMessageSendFailed.CONSTRUCTOR: + this.updates[i] = new UpdateMessageSendFailed(input); + break; + case UpdateMessageContent.CONSTRUCTOR: + this.updates[i] = new UpdateMessageContent(input); + break; + case UpdateMessageEdited.CONSTRUCTOR: + this.updates[i] = new UpdateMessageEdited(input); + break; + case UpdateMessageViews.CONSTRUCTOR: + this.updates[i] = new UpdateMessageViews(input); + break; + case UpdateMessageContentOpened.CONSTRUCTOR: + this.updates[i] = new UpdateMessageContentOpened(input); + break; + case UpdateMessageMentionRead.CONSTRUCTOR: + this.updates[i] = new UpdateMessageMentionRead(input); + break; + case UpdateMessageLiveLocationViewed.CONSTRUCTOR: + this.updates[i] = new UpdateMessageLiveLocationViewed(input); + break; + case UpdateNewChat.CONSTRUCTOR: + this.updates[i] = new UpdateNewChat(input); + break; + case UpdateChatChatList.CONSTRUCTOR: + this.updates[i] = new UpdateChatChatList(input); + break; + case UpdateChatTitle.CONSTRUCTOR: + this.updates[i] = new UpdateChatTitle(input); + break; + case UpdateChatPhoto.CONSTRUCTOR: + this.updates[i] = new UpdateChatPhoto(input); + break; + case UpdateChatPermissions.CONSTRUCTOR: + this.updates[i] = new UpdateChatPermissions(input); + break; + case UpdateChatLastMessage.CONSTRUCTOR: + this.updates[i] = new UpdateChatLastMessage(input); + break; + case UpdateChatOrder.CONSTRUCTOR: + this.updates[i] = new UpdateChatOrder(input); + break; + case UpdateChatIsPinned.CONSTRUCTOR: + this.updates[i] = new UpdateChatIsPinned(input); + break; + case UpdateChatIsMarkedAsUnread.CONSTRUCTOR: + this.updates[i] = new UpdateChatIsMarkedAsUnread(input); + break; + case UpdateChatIsSponsored.CONSTRUCTOR: + this.updates[i] = new UpdateChatIsSponsored(input); + break; + case UpdateChatHasScheduledMessages.CONSTRUCTOR: + this.updates[i] = new UpdateChatHasScheduledMessages(input); + break; + case UpdateChatDefaultDisableNotification.CONSTRUCTOR: + this.updates[i] = new UpdateChatDefaultDisableNotification(input); + break; + case UpdateChatReadInbox.CONSTRUCTOR: + this.updates[i] = new UpdateChatReadInbox(input); + break; + case UpdateChatReadOutbox.CONSTRUCTOR: + this.updates[i] = new UpdateChatReadOutbox(input); + break; + case UpdateChatUnreadMentionCount.CONSTRUCTOR: + this.updates[i] = new UpdateChatUnreadMentionCount(input); + break; + case UpdateChatNotificationSettings.CONSTRUCTOR: + this.updates[i] = new UpdateChatNotificationSettings(input); + break; + case UpdateScopeNotificationSettings.CONSTRUCTOR: + this.updates[i] = new UpdateScopeNotificationSettings(input); + break; + case UpdateChatActionBar.CONSTRUCTOR: + this.updates[i] = new UpdateChatActionBar(input); + break; + case UpdateChatPinnedMessage.CONSTRUCTOR: + this.updates[i] = new UpdateChatPinnedMessage(input); + break; + case UpdateChatReplyMarkup.CONSTRUCTOR: + this.updates[i] = new UpdateChatReplyMarkup(input); + break; + case UpdateChatDraftMessage.CONSTRUCTOR: + this.updates[i] = new UpdateChatDraftMessage(input); + break; + case UpdateChatOnlineMemberCount.CONSTRUCTOR: + this.updates[i] = new UpdateChatOnlineMemberCount(input); + break; + case UpdateNotification.CONSTRUCTOR: + this.updates[i] = new UpdateNotification(input); + break; + case UpdateNotificationGroup.CONSTRUCTOR: + this.updates[i] = new UpdateNotificationGroup(input); + break; + case UpdateActiveNotifications.CONSTRUCTOR: + this.updates[i] = new UpdateActiveNotifications(input); + break; + case UpdateHavePendingNotifications.CONSTRUCTOR: + this.updates[i] = new UpdateHavePendingNotifications(input); + break; + case UpdateDeleteMessages.CONSTRUCTOR: + this.updates[i] = new UpdateDeleteMessages(input); + break; + case UpdateUserChatAction.CONSTRUCTOR: + this.updates[i] = new UpdateUserChatAction(input); + break; + case UpdateUserStatus.CONSTRUCTOR: + this.updates[i] = new UpdateUserStatus(input); + break; + case UpdateUser.CONSTRUCTOR: + this.updates[i] = new UpdateUser(input); + break; + case UpdateBasicGroup.CONSTRUCTOR: + this.updates[i] = new UpdateBasicGroup(input); + break; + case UpdateSupergroup.CONSTRUCTOR: + this.updates[i] = new UpdateSupergroup(input); + break; + case UpdateSecretChat.CONSTRUCTOR: + this.updates[i] = new UpdateSecretChat(input); + break; + case UpdateUserFullInfo.CONSTRUCTOR: + this.updates[i] = new UpdateUserFullInfo(input); + break; + case UpdateBasicGroupFullInfo.CONSTRUCTOR: + this.updates[i] = new UpdateBasicGroupFullInfo(input); + break; + case UpdateSupergroupFullInfo.CONSTRUCTOR: + this.updates[i] = new UpdateSupergroupFullInfo(input); + break; + case UpdateServiceNotification.CONSTRUCTOR: + this.updates[i] = new UpdateServiceNotification(input); + break; + case UpdateFile.CONSTRUCTOR: + this.updates[i] = new UpdateFile(input); + break; + case UpdateFileGenerationStart.CONSTRUCTOR: + this.updates[i] = new UpdateFileGenerationStart(input); + break; + case UpdateFileGenerationStop.CONSTRUCTOR: + this.updates[i] = new UpdateFileGenerationStop(input); + break; + case UpdateCall.CONSTRUCTOR: + this.updates[i] = new UpdateCall(input); + break; + case UpdateUserPrivacySettingRules.CONSTRUCTOR: + this.updates[i] = new UpdateUserPrivacySettingRules(input); + break; + case UpdateUnreadMessageCount.CONSTRUCTOR: + this.updates[i] = new UpdateUnreadMessageCount(input); + break; + case UpdateUnreadChatCount.CONSTRUCTOR: + this.updates[i] = new UpdateUnreadChatCount(input); + break; + case UpdateOption.CONSTRUCTOR: + this.updates[i] = new UpdateOption(input); + break; + case UpdateStickerSet.CONSTRUCTOR: + this.updates[i] = new UpdateStickerSet(input); + break; + case UpdateInstalledStickerSets.CONSTRUCTOR: + this.updates[i] = new UpdateInstalledStickerSets(input); + break; + case UpdateTrendingStickerSets.CONSTRUCTOR: + this.updates[i] = new UpdateTrendingStickerSets(input); + break; + case UpdateRecentStickers.CONSTRUCTOR: + this.updates[i] = new UpdateRecentStickers(input); + break; + case UpdateFavoriteStickers.CONSTRUCTOR: + this.updates[i] = new UpdateFavoriteStickers(input); + break; + case UpdateSavedAnimations.CONSTRUCTOR: + this.updates[i] = new UpdateSavedAnimations(input); + break; + case UpdateSelectedBackground.CONSTRUCTOR: + this.updates[i] = new UpdateSelectedBackground(input); + break; + case UpdateLanguagePackStrings.CONSTRUCTOR: + this.updates[i] = new UpdateLanguagePackStrings(input); + break; + case UpdateConnectionState.CONSTRUCTOR: + this.updates[i] = new UpdateConnectionState(input); + break; + case UpdateTermsOfService.CONSTRUCTOR: + this.updates[i] = new UpdateTermsOfService(input); + break; + case UpdateUsersNearby.CONSTRUCTOR: + this.updates[i] = new UpdateUsersNearby(input); + break; + case UpdateDiceEmojis.CONSTRUCTOR: + this.updates[i] = new UpdateDiceEmojis(input); + break; + case UpdateNewInlineQuery.CONSTRUCTOR: + this.updates[i] = new UpdateNewInlineQuery(input); + break; + case UpdateNewChosenInlineResult.CONSTRUCTOR: + this.updates[i] = new UpdateNewChosenInlineResult(input); + break; + case UpdateNewCallbackQuery.CONSTRUCTOR: + this.updates[i] = new UpdateNewCallbackQuery(input); + break; + case UpdateNewInlineCallbackQuery.CONSTRUCTOR: + this.updates[i] = new UpdateNewInlineCallbackQuery(input); + break; + case UpdateNewShippingQuery.CONSTRUCTOR: + this.updates[i] = new UpdateNewShippingQuery(input); + break; + case UpdateNewPreCheckoutQuery.CONSTRUCTOR: + this.updates[i] = new UpdateNewPreCheckoutQuery(input); + break; + case UpdateNewCustomEvent.CONSTRUCTOR: + this.updates[i] = new UpdateNewCustomEvent(input); + break; + case UpdateNewCustomQuery.CONSTRUCTOR: + this.updates[i] = new UpdateNewCustomQuery(input); + break; + case UpdatePoll.CONSTRUCTOR: + this.updates[i] = new UpdatePoll(input); + break; + case UpdatePollAnswer.CONSTRUCTOR: + this.updates[i] = new UpdatePollAnswer(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.updates.length); + for (int i = 0; i < this.updates.length; i++) { + this.updates[i].serialize(output); + } + } } public static class User extends Object { @@ -14641,8 +37942,9 @@ public class TdApi { public UserType type; public String languageCode; - public User() { - } + public static final int CONSTRUCTOR = -824771497; + + public User() {} public User(int id, String firstName, String lastName, String username, String phoneNumber, UserStatus status, ProfilePhoto profilePhoto, boolean isContact, boolean isMutualContact, boolean isVerified, boolean isSupport, String restrictionReason, boolean isScam, boolean haveAccess, UserType type, String languageCode) { this.id = id; @@ -14663,12 +37965,174 @@ public class TdApi { this.languageCode = languageCode; } - public static final int CONSTRUCTOR = -824771497; + public User(DataInputStream input) throws IOException { + this.id = input.readInt(); + if (input.readBoolean()) { + var firstNameTmp = new byte[input.readInt()]; + input.readFully(firstNameTmp); + this.firstName = new String(firstNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var lastNameTmp = new byte[input.readInt()]; + input.readFully(lastNameTmp); + this.lastName = new String(lastNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case UserStatusEmpty.CONSTRUCTOR: + this.status = new UserStatusEmpty(input); + break; + case UserStatusOnline.CONSTRUCTOR: + this.status = new UserStatusOnline(input); + break; + case UserStatusOffline.CONSTRUCTOR: + this.status = new UserStatusOffline(input); + break; + case UserStatusRecently.CONSTRUCTOR: + this.status = new UserStatusRecently(input); + break; + case UserStatusLastWeek.CONSTRUCTOR: + this.status = new UserStatusLastWeek(input); + break; + case UserStatusLastMonth.CONSTRUCTOR: + this.status = new UserStatusLastMonth(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (ProfilePhoto.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.profilePhoto = new ProfilePhoto(input); + } + this.isContact = input.readBoolean(); + this.isMutualContact = input.readBoolean(); + this.isVerified = input.readBoolean(); + this.isSupport = input.readBoolean(); + if (input.readBoolean()) { + var restrictionReasonTmp = new byte[input.readInt()]; + input.readFully(restrictionReasonTmp); + this.restrictionReason = new String(restrictionReasonTmp, StandardCharsets.UTF_8); + } + this.isScam = input.readBoolean(); + this.haveAccess = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case UserTypeRegular.CONSTRUCTOR: + this.type = new UserTypeRegular(input); + break; + case UserTypeDeleted.CONSTRUCTOR: + this.type = new UserTypeDeleted(input); + break; + case UserTypeBot.CONSTRUCTOR: + this.type = new UserTypeBot(input); + break; + case UserTypeUnknown.CONSTRUCTOR: + this.type = new UserTypeUnknown(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var languageCodeTmp = new byte[input.readInt()]; + input.readFully(languageCodeTmp); + this.languageCode = new String(languageCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.id); + if (this.firstName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var firstNameTmp = this.firstName.getBytes(StandardCharsets.UTF_8); + output.writeInt(firstNameTmp.length); + output.write(firstNameTmp); + } + if (this.lastName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var lastNameTmp = this.lastName.getBytes(StandardCharsets.UTF_8); + output.writeInt(lastNameTmp.length); + output.write(lastNameTmp); + } + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + if (this.profilePhoto == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.profilePhoto.serialize(output); + } + output.writeBoolean(this.isContact); + output.writeBoolean(this.isMutualContact); + output.writeBoolean(this.isVerified); + output.writeBoolean(this.isSupport); + if (this.restrictionReason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var restrictionReasonTmp = this.restrictionReason.getBytes(StandardCharsets.UTF_8); + output.writeInt(restrictionReasonTmp.length); + output.write(restrictionReasonTmp); + } + output.writeBoolean(this.isScam); + output.writeBoolean(this.haveAccess); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.languageCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languageCodeTmp = this.languageCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(languageCodeTmp.length); + output.write(languageCodeTmp); + } + } } public static class UserFullInfo extends Object { @@ -14681,8 +38145,9 @@ public class TdApi { public int groupInCommonCount; public BotInfo botInfo; - public UserFullInfo() { - } + public static final int CONSTRUCTOR = 333888500; + + public UserFullInfo() {} public UserFullInfo(boolean isBlocked, boolean canBeCalled, boolean hasPrivateCalls, boolean needPhoneNumberPrivacyException, String bio, String shareText, int groupInCommonCount, BotInfo botInfo) { this.isBlocked = isBlocked; @@ -14695,264 +38160,462 @@ public class TdApi { this.botInfo = botInfo; } - public static final int CONSTRUCTOR = 333888500; + public UserFullInfo(DataInputStream input) throws IOException { + this.isBlocked = input.readBoolean(); + this.canBeCalled = input.readBoolean(); + this.hasPrivateCalls = input.readBoolean(); + this.needPhoneNumberPrivacyException = input.readBoolean(); + if (input.readBoolean()) { + var bioTmp = new byte[input.readInt()]; + input.readFully(bioTmp); + this.bio = new String(bioTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var shareTextTmp = new byte[input.readInt()]; + input.readFully(shareTextTmp); + this.shareText = new String(shareTextTmp, StandardCharsets.UTF_8); + } + this.groupInCommonCount = input.readInt(); + if (input.readBoolean()) { + if (BotInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.botInfo = new BotInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class UserPrivacySetting extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isBlocked); + output.writeBoolean(this.canBeCalled); + output.writeBoolean(this.hasPrivateCalls); + output.writeBoolean(this.needPhoneNumberPrivacyException); + if (this.bio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var bioTmp = this.bio.getBytes(StandardCharsets.UTF_8); + output.writeInt(bioTmp.length); + output.write(bioTmp); + } + if (this.shareText == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var shareTextTmp = this.shareText.getBytes(StandardCharsets.UTF_8); + output.writeInt(shareTextTmp.length); + output.write(shareTextTmp); + } + output.writeInt(this.groupInCommonCount); + if (this.botInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.botInfo.serialize(output); + } + } } public static class UserPrivacySettingShowStatus extends UserPrivacySetting { - - public UserPrivacySettingShowStatus() { - } - public static final int CONSTRUCTOR = 1862829310; - @Override + public UserPrivacySettingShowStatus() {} + + + public UserPrivacySettingShowStatus(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingShowProfilePhoto extends UserPrivacySetting { - - public UserPrivacySettingShowProfilePhoto() { - } - public static final int CONSTRUCTOR = 1408485877; - @Override + public UserPrivacySettingShowProfilePhoto() {} + + + public UserPrivacySettingShowProfilePhoto(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingShowLinkInForwardedMessages extends UserPrivacySetting { - - public UserPrivacySettingShowLinkInForwardedMessages() { - } - public static final int CONSTRUCTOR = 592688870; - @Override + public UserPrivacySettingShowLinkInForwardedMessages() {} + + + public UserPrivacySettingShowLinkInForwardedMessages(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingShowPhoneNumber extends UserPrivacySetting { - - public UserPrivacySettingShowPhoneNumber() { - } - public static final int CONSTRUCTOR = -791567831; - @Override + public UserPrivacySettingShowPhoneNumber() {} + + + public UserPrivacySettingShowPhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingAllowChatInvites extends UserPrivacySetting { - - public UserPrivacySettingAllowChatInvites() { - } - public static final int CONSTRUCTOR = 1271668007; - @Override + public UserPrivacySettingAllowChatInvites() {} + + + public UserPrivacySettingAllowChatInvites(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingAllowCalls extends UserPrivacySetting { - - public UserPrivacySettingAllowCalls() { - } - public static final int CONSTRUCTOR = -906967291; - @Override + public UserPrivacySettingAllowCalls() {} + + + public UserPrivacySettingAllowCalls(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingAllowPeerToPeerCalls extends UserPrivacySetting { - - public UserPrivacySettingAllowPeerToPeerCalls() { - } - public static final int CONSTRUCTOR = 352500032; - @Override + public UserPrivacySettingAllowPeerToPeerCalls() {} + + + public UserPrivacySettingAllowPeerToPeerCalls(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingAllowFindingByPhoneNumber extends UserPrivacySetting { - - public UserPrivacySettingAllowFindingByPhoneNumber() { - } - public static final int CONSTRUCTOR = -1846645423; - @Override + public UserPrivacySettingAllowFindingByPhoneNumber() {} + + + public UserPrivacySettingAllowFindingByPhoneNumber(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class UserPrivacySettingRule extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingRuleAllowAll extends UserPrivacySettingRule { - - public UserPrivacySettingRuleAllowAll() { - } - public static final int CONSTRUCTOR = -1967186881; - @Override + public UserPrivacySettingRuleAllowAll() {} + + + public UserPrivacySettingRuleAllowAll(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingRuleAllowContacts extends UserPrivacySettingRule { - - public UserPrivacySettingRuleAllowContacts() { - } - public static final int CONSTRUCTOR = -1892733680; - @Override + public UserPrivacySettingRuleAllowContacts() {} + + + public UserPrivacySettingRuleAllowContacts(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingRuleAllowUsers extends UserPrivacySettingRule { public int[] userIds; - public UserPrivacySettingRuleAllowUsers() { - } + public static final int CONSTRUCTOR = 427601278; + + public UserPrivacySettingRuleAllowUsers() {} public UserPrivacySettingRuleAllowUsers(int[] userIds) { this.userIds = userIds; } - public static final int CONSTRUCTOR = 427601278; + public UserPrivacySettingRuleAllowUsers(DataInputStream input) throws IOException { + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + } } public static class UserPrivacySettingRuleAllowChatMembers extends UserPrivacySettingRule { public long[] chatIds; - public UserPrivacySettingRuleAllowChatMembers() { - } + public static final int CONSTRUCTOR = -2048749863; + + public UserPrivacySettingRuleAllowChatMembers() {} public UserPrivacySettingRuleAllowChatMembers(long[] chatIds) { this.chatIds = chatIds; } - public static final int CONSTRUCTOR = -2048749863; + public UserPrivacySettingRuleAllowChatMembers(DataInputStream input) throws IOException { + this.chatIds = new long[input.readInt()]; + for (int i = 0; i < this.chatIds.length; i++) { + this.chatIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.chatIds.length); + for (int i = 0; i < this.chatIds.length; i++) { + output.writeLong(this.chatIds[i]); + } + } } public static class UserPrivacySettingRuleRestrictAll extends UserPrivacySettingRule { - - public UserPrivacySettingRuleRestrictAll() { - } - public static final int CONSTRUCTOR = -1406495408; - @Override + public UserPrivacySettingRuleRestrictAll() {} + + + public UserPrivacySettingRuleRestrictAll(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingRuleRestrictContacts extends UserPrivacySettingRule { - - public UserPrivacySettingRuleRestrictContacts() { - } - public static final int CONSTRUCTOR = 1008389378; - @Override + public UserPrivacySettingRuleRestrictContacts() {} + + + public UserPrivacySettingRuleRestrictContacts(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserPrivacySettingRuleRestrictUsers extends UserPrivacySettingRule { public int[] userIds; - public UserPrivacySettingRuleRestrictUsers() { - } + public static final int CONSTRUCTOR = 2119951802; + + public UserPrivacySettingRuleRestrictUsers() {} public UserPrivacySettingRuleRestrictUsers(int[] userIds) { this.userIds = userIds; } - public static final int CONSTRUCTOR = 2119951802; + public UserPrivacySettingRuleRestrictUsers(DataInputStream input) throws IOException { + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + } } public static class UserPrivacySettingRuleRestrictChatMembers extends UserPrivacySettingRule { public long[] chatIds; - public UserPrivacySettingRuleRestrictChatMembers() { - } + public static final int CONSTRUCTOR = 392530897; + + public UserPrivacySettingRuleRestrictChatMembers() {} public UserPrivacySettingRuleRestrictChatMembers(long[] chatIds) { this.chatIds = chatIds; } - public static final int CONSTRUCTOR = 392530897; + public UserPrivacySettingRuleRestrictChatMembers(DataInputStream input) throws IOException { + this.chatIds = new long[input.readInt()]; + for (int i = 0; i < this.chatIds.length; i++) { + this.chatIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.chatIds.length); + for (int i = 0; i < this.chatIds.length; i++) { + output.writeLong(this.chatIds[i]); + } + } } public static class UserPrivacySettingRules extends Object { public UserPrivacySettingRule[] rules; - public UserPrivacySettingRules() { - } + public static final int CONSTRUCTOR = 322477541; + + public UserPrivacySettingRules() {} public UserPrivacySettingRules(UserPrivacySettingRule[] rules) { this.rules = rules; } - public static final int CONSTRUCTOR = 322477541; + public UserPrivacySettingRules(DataInputStream input) throws IOException { + this.rules = new UserPrivacySettingRule[input.readInt()]; + for (int i = 0; i < this.rules.length; i++) { + switch(input.readInt()) { + case UserPrivacySettingRuleAllowAll.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleAllowAll(input); + break; + case UserPrivacySettingRuleAllowContacts.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleAllowContacts(input); + break; + case UserPrivacySettingRuleAllowUsers.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleAllowUsers(input); + break; + case UserPrivacySettingRuleAllowChatMembers.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleAllowChatMembers(input); + break; + case UserPrivacySettingRuleRestrictAll.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleRestrictAll(input); + break; + case UserPrivacySettingRuleRestrictContacts.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleRestrictContacts(input); + break; + case UserPrivacySettingRuleRestrictUsers.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleRestrictUsers(input); + break; + case UserPrivacySettingRuleRestrictChatMembers.CONSTRUCTOR: + this.rules[i] = new UserPrivacySettingRuleRestrictChatMembers(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.rules.length); + for (int i = 0; i < this.rules.length; i++) { + this.rules[i].serialize(output); + } + } } public static class UserProfilePhoto extends Object { @@ -14960,8 +38623,9 @@ public class TdApi { public int addedDate; public PhotoSize[] sizes; - public UserProfilePhoto() { - } + public static final int CONSTRUCTOR = -1882596466; + + public UserProfilePhoto() {} public UserProfilePhoto(long id, int addedDate, PhotoSize[] sizes) { this.id = id; @@ -14969,152 +38633,227 @@ public class TdApi { this.sizes = sizes; } - public static final int CONSTRUCTOR = -1882596466; + public UserProfilePhoto(DataInputStream input) throws IOException { + this.id = input.readLong(); + this.addedDate = input.readInt(); + this.sizes = new PhotoSize[input.readInt()]; + for (int i = 0; i < this.sizes.length; i++) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sizes[i] = new PhotoSize(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.id); + output.writeInt(this.addedDate); + output.writeInt(this.sizes.length); + for (int i = 0; i < this.sizes.length; i++) { + this.sizes[i].serialize(output); + } + } } public static class UserProfilePhotos extends Object { public int totalCount; public UserProfilePhoto[] photos; - public UserProfilePhotos() { - } + public static final int CONSTRUCTOR = 1512709690; + + public UserProfilePhotos() {} public UserProfilePhotos(int totalCount, UserProfilePhoto[] photos) { this.totalCount = totalCount; this.photos = photos; } - public static final int CONSTRUCTOR = 1512709690; + public UserProfilePhotos(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + this.photos = new UserProfilePhoto[input.readInt()]; + for (int i = 0; i < this.photos.length; i++) { + if (UserProfilePhoto.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photos[i] = new UserProfilePhoto(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class UserStatus extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + output.writeInt(this.photos.length); + for (int i = 0; i < this.photos.length; i++) { + this.photos[i].serialize(output); + } + } } public static class UserStatusEmpty extends UserStatus { - - public UserStatusEmpty() { - } - public static final int CONSTRUCTOR = 164646985; - @Override + public UserStatusEmpty() {} + + + public UserStatusEmpty(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserStatusOnline extends UserStatus { public int expires; - public UserStatusOnline() { - } + public static final int CONSTRUCTOR = -1529460876; + + public UserStatusOnline() {} public UserStatusOnline(int expires) { this.expires = expires; } - public static final int CONSTRUCTOR = -1529460876; + public UserStatusOnline(DataInputStream input) throws IOException { + this.expires = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.expires); + } } public static class UserStatusOffline extends UserStatus { public int wasOnline; - public UserStatusOffline() { - } + public static final int CONSTRUCTOR = -759984891; + + public UserStatusOffline() {} public UserStatusOffline(int wasOnline) { this.wasOnline = wasOnline; } - public static final int CONSTRUCTOR = -759984891; + public UserStatusOffline(DataInputStream input) throws IOException { + this.wasOnline = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.wasOnline); + } } public static class UserStatusRecently extends UserStatus { - - public UserStatusRecently() { - } - public static final int CONSTRUCTOR = -496024847; - @Override + public UserStatusRecently() {} + + + public UserStatusRecently(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserStatusLastWeek extends UserStatus { - - public UserStatusLastWeek() { - } - public static final int CONSTRUCTOR = 129960444; - @Override + public UserStatusLastWeek() {} + + + public UserStatusLastWeek(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserStatusLastMonth extends UserStatus { - - public UserStatusLastMonth() { - } - public static final int CONSTRUCTOR = 2011940674; - @Override + public UserStatusLastMonth() {} + + + public UserStatusLastMonth(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } - } - public abstract static class UserType extends Object { + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserTypeRegular extends UserType { - - public UserTypeRegular() { - } - public static final int CONSTRUCTOR = -598644325; - @Override + public UserTypeRegular() {} + + + public UserTypeRegular(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserTypeDeleted extends UserType { - - public UserTypeDeleted() { - } - public static final int CONSTRUCTOR = -1807729372; - @Override + public UserTypeDeleted() {} + + + public UserTypeDeleted(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class UserTypeBot extends UserType { @@ -15124,8 +38863,9 @@ public class TdApi { public String inlineQueryPlaceholder; public boolean needLocation; - public UserTypeBot() { - } + public static final int CONSTRUCTOR = 1262387765; + + public UserTypeBot() {} public UserTypeBot(boolean canJoinGroups, boolean canReadAllGroupMessages, boolean isInline, String inlineQueryPlaceholder, boolean needLocation) { this.canJoinGroups = canJoinGroups; @@ -15135,65 +38875,139 @@ public class TdApi { this.needLocation = needLocation; } - public static final int CONSTRUCTOR = 1262387765; + public UserTypeBot(DataInputStream input) throws IOException { + this.canJoinGroups = input.readBoolean(); + this.canReadAllGroupMessages = input.readBoolean(); + this.isInline = input.readBoolean(); + if (input.readBoolean()) { + var inlineQueryPlaceholderTmp = new byte[input.readInt()]; + input.readFully(inlineQueryPlaceholderTmp); + this.inlineQueryPlaceholder = new String(inlineQueryPlaceholderTmp, StandardCharsets.UTF_8); + } + this.needLocation = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.canJoinGroups); + output.writeBoolean(this.canReadAllGroupMessages); + output.writeBoolean(this.isInline); + if (this.inlineQueryPlaceholder == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineQueryPlaceholderTmp = this.inlineQueryPlaceholder.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineQueryPlaceholderTmp.length); + output.write(inlineQueryPlaceholderTmp); + } + output.writeBoolean(this.needLocation); + } } public static class UserTypeUnknown extends UserType { - - public UserTypeUnknown() { - } - public static final int CONSTRUCTOR = -724541123; - @Override + public UserTypeUnknown() {} + + + public UserTypeUnknown(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class Users extends Object { public int totalCount; public int[] userIds; - public Users() { - } + public static final int CONSTRUCTOR = 273760088; + + public Users() {} public Users(int totalCount, int[] userIds) { this.totalCount = totalCount; this.userIds = userIds; } - public static final int CONSTRUCTOR = 273760088; + public Users(DataInputStream input) throws IOException { + this.totalCount = input.readInt(); + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.totalCount); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + } } public static class ValidatedOrderInfo extends Object { public String orderInfoId; public ShippingOption[] shippingOptions; - public ValidatedOrderInfo() { - } + public static final int CONSTRUCTOR = 1511451484; + + public ValidatedOrderInfo() {} public ValidatedOrderInfo(String orderInfoId, ShippingOption[] shippingOptions) { this.orderInfoId = orderInfoId; this.shippingOptions = shippingOptions; } - public static final int CONSTRUCTOR = 1511451484; + public ValidatedOrderInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var orderInfoIdTmp = new byte[input.readInt()]; + input.readFully(orderInfoIdTmp); + this.orderInfoId = new String(orderInfoIdTmp, StandardCharsets.UTF_8); + } + this.shippingOptions = new ShippingOption[input.readInt()]; + for (int i = 0; i < this.shippingOptions.length; i++) { + if (ShippingOption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.shippingOptions[i] = new ShippingOption(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.orderInfoId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var orderInfoIdTmp = this.orderInfoId.getBytes(StandardCharsets.UTF_8); + output.writeInt(orderInfoIdTmp.length); + output.write(orderInfoIdTmp); + } + output.writeInt(this.shippingOptions.length); + for (int i = 0; i < this.shippingOptions.length; i++) { + this.shippingOptions[i].serialize(output); + } + } } public static class Venue extends Object { @@ -15204,8 +39018,9 @@ public class TdApi { public String id; public String type; - public Venue() { - } + public static final int CONSTRUCTOR = 1070406393; + + public Venue() {} public Venue(Location location, String title, String address, String provider, String id, String type) { this.location = location; @@ -15216,12 +39031,93 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = 1070406393; + public Venue(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var addressTmp = new byte[input.readInt()]; + input.readFully(addressTmp); + this.address = new String(addressTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var providerTmp = new byte[input.readInt()]; + input.readFully(providerTmp); + this.provider = new String(providerTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var idTmp = new byte[input.readInt()]; + input.readFully(idTmp); + this.id = new String(idTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var typeTmp = new byte[input.readInt()]; + input.readFully(typeTmp); + this.type = new String(typeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.address == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var addressTmp = this.address.getBytes(StandardCharsets.UTF_8); + output.writeInt(addressTmp.length); + output.write(addressTmp); + } + if (this.provider == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var providerTmp = this.provider.getBytes(StandardCharsets.UTF_8); + output.writeInt(providerTmp.length); + output.write(providerTmp); + } + if (this.id == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var idTmp = this.id.getBytes(StandardCharsets.UTF_8); + output.writeInt(idTmp.length); + output.write(idTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var typeTmp = this.type.getBytes(StandardCharsets.UTF_8); + output.writeInt(typeTmp.length); + output.write(typeTmp); + } + } } public static class Video extends Object { @@ -15236,8 +39132,9 @@ public class TdApi { public PhotoSize thumbnail; public File video; - public Video() { - } + public static final int CONSTRUCTOR = -536898740; + + public Video() {} public Video(int duration, int width, int height, String fileName, String mimeType, boolean hasStickers, boolean supportsStreaming, Minithumbnail minithumbnail, PhotoSize thumbnail, File video) { this.duration = duration; @@ -15252,12 +39149,88 @@ public class TdApi { this.video = video; } - public static final int CONSTRUCTOR = -536898740; + public Video(DataInputStream input) throws IOException { + this.duration = input.readInt(); + this.width = input.readInt(); + this.height = input.readInt(); + if (input.readBoolean()) { + var fileNameTmp = new byte[input.readInt()]; + input.readFully(fileNameTmp); + this.fileName = new String(fileNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + this.hasStickers = input.readBoolean(); + this.supportsStreaming = input.readBoolean(); + if (input.readBoolean()) { + if (Minithumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.minithumbnail = new Minithumbnail(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.duration); + output.writeInt(this.width); + output.writeInt(this.height); + if (this.fileName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fileNameTmp = this.fileName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fileNameTmp.length); + output.write(fileNameTmp); + } + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + output.writeBoolean(this.hasStickers); + output.writeBoolean(this.supportsStreaming); + if (this.minithumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.minithumbnail.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + } } public static class VideoNote extends Object { @@ -15267,8 +39240,9 @@ public class TdApi { public PhotoSize thumbnail; public File video; - public VideoNote() { - } + public static final int CONSTRUCTOR = -1080075672; + + public VideoNote() {} public VideoNote(int duration, int length, Minithumbnail minithumbnail, PhotoSize thumbnail, File video) { this.duration = duration; @@ -15278,12 +39252,56 @@ public class TdApi { this.video = video; } - public static final int CONSTRUCTOR = -1080075672; + public VideoNote(DataInputStream input) throws IOException { + this.duration = input.readInt(); + this.length = input.readInt(); + if (input.readBoolean()) { + if (Minithumbnail.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.minithumbnail = new Minithumbnail(input); + } + if (input.readBoolean()) { + if (PhotoSize.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.thumbnail = new PhotoSize(input); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.duration); + output.writeInt(this.length); + if (this.minithumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.minithumbnail.serialize(output); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + } } public static class VoiceNote extends Object { @@ -15292,8 +39310,9 @@ public class TdApi { public String mimeType; public File voice; - public VoiceNote() { - } + public static final int CONSTRUCTOR = -2066012058; + + public VoiceNote() {} public VoiceNote(int duration, byte[] waveform, String mimeType, File voice) { this.duration = duration; @@ -15302,12 +39321,47 @@ public class TdApi { this.voice = voice; } - public static final int CONSTRUCTOR = -2066012058; + public VoiceNote(DataInputStream input) throws IOException { + this.duration = input.readInt(); + this.waveform = new byte[input.readInt()]; + input.readFully(this.waveform); + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (File.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.voice = new File(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.duration); + output.writeInt(this.waveform.length); + output.write(this.waveform); + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + if (this.voice == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voice.serialize(output); + } + } } public static class WebPage extends Object { @@ -15333,8 +39387,9 @@ public class TdApi { public VoiceNote voiceNote; public int instantViewVersion; - public WebPage() { - } + public static final int CONSTRUCTOR = -577333714; + + public WebPage() {} public WebPage(String url, String displayUrl, String type, String siteName, String title, FormattedText description, Photo photo, String embedUrl, String embedType, int embedWidth, int embedHeight, int duration, String author, Animation animation, Audio audio, Document document, Sticker sticker, Video video, VideoNote videoNote, VoiceNote voiceNote, int instantViewVersion) { this.url = url; @@ -15360,12 +39415,236 @@ public class TdApi { this.instantViewVersion = instantViewVersion; } - public static final int CONSTRUCTOR = -577333714; + public WebPage(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var displayUrlTmp = new byte[input.readInt()]; + input.readFully(displayUrlTmp); + this.displayUrl = new String(displayUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var typeTmp = new byte[input.readInt()]; + input.readFully(typeTmp); + this.type = new String(typeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var siteNameTmp = new byte[input.readInt()]; + input.readFully(siteNameTmp); + this.siteName = new String(siteNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.description = new FormattedText(input); + } + if (input.readBoolean()) { + if (Photo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.photo = new Photo(input); + } + if (input.readBoolean()) { + var embedUrlTmp = new byte[input.readInt()]; + input.readFully(embedUrlTmp); + this.embedUrl = new String(embedUrlTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var embedTypeTmp = new byte[input.readInt()]; + input.readFully(embedTypeTmp); + this.embedType = new String(embedTypeTmp, StandardCharsets.UTF_8); + } + this.embedWidth = input.readInt(); + this.embedHeight = input.readInt(); + this.duration = input.readInt(); + if (input.readBoolean()) { + var authorTmp = new byte[input.readInt()]; + input.readFully(authorTmp); + this.author = new String(authorTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (Animation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.animation = new Animation(input); + } + if (input.readBoolean()) { + if (Audio.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.audio = new Audio(input); + } + if (input.readBoolean()) { + if (Document.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.document = new Document(input); + } + if (input.readBoolean()) { + if (Sticker.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.sticker = new Sticker(input); + } + if (input.readBoolean()) { + if (Video.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.video = new Video(input); + } + if (input.readBoolean()) { + if (VideoNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.videoNote = new VideoNote(input); + } + if (input.readBoolean()) { + if (VoiceNote.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.voiceNote = new VoiceNote(input); + } + this.instantViewVersion = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + if (this.displayUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var displayUrlTmp = this.displayUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(displayUrlTmp.length); + output.write(displayUrlTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var typeTmp = this.type.getBytes(StandardCharsets.UTF_8); + output.writeInt(typeTmp.length); + output.write(typeTmp); + } + if (this.siteName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var siteNameTmp = this.siteName.getBytes(StandardCharsets.UTF_8); + output.writeInt(siteNameTmp.length); + output.write(siteNameTmp); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.description.serialize(output); + } + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + if (this.embedUrl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var embedUrlTmp = this.embedUrl.getBytes(StandardCharsets.UTF_8); + output.writeInt(embedUrlTmp.length); + output.write(embedUrlTmp); + } + if (this.embedType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var embedTypeTmp = this.embedType.getBytes(StandardCharsets.UTF_8); + output.writeInt(embedTypeTmp.length); + output.write(embedTypeTmp); + } + output.writeInt(this.embedWidth); + output.writeInt(this.embedHeight); + output.writeInt(this.duration); + if (this.author == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var authorTmp = this.author.getBytes(StandardCharsets.UTF_8); + output.writeInt(authorTmp.length); + output.write(authorTmp); + } + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + if (this.audio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.audio.serialize(output); + } + if (this.document == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.document.serialize(output); + } + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + if (this.video == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.video.serialize(output); + } + if (this.videoNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.videoNote.serialize(output); + } + if (this.voiceNote == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.voiceNote.serialize(output); + } + output.writeInt(this.instantViewVersion); + } } public static class WebPageInstantView extends Object { @@ -15375,8 +39654,9 @@ public class TdApi { public boolean isRtl; public boolean isFull; - public WebPageInstantView() { - } + public static final int CONSTRUCTOR = 1069193541; + + public WebPageInstantView() {} public WebPageInstantView(PageBlock[] pageBlocks, int viewCount, int version, boolean isRtl, boolean isFull) { this.pageBlocks = pageBlocks; @@ -15386,50 +39666,197 @@ public class TdApi { this.isFull = isFull; } - public static final int CONSTRUCTOR = 1069193541; + public WebPageInstantView(DataInputStream input) throws IOException { + this.pageBlocks = new PageBlock[input.readInt()]; + for (int i = 0; i < this.pageBlocks.length; i++) { + switch(input.readInt()) { + case PageBlockTitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTitle(input); + break; + case PageBlockSubtitle.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubtitle(input); + break; + case PageBlockAuthorDate.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAuthorDate(input); + break; + case PageBlockHeader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockHeader(input); + break; + case PageBlockSubheader.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSubheader(input); + break; + case PageBlockKicker.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockKicker(input); + break; + case PageBlockParagraph.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockParagraph(input); + break; + case PageBlockPreformatted.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPreformatted(input); + break; + case PageBlockFooter.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockFooter(input); + break; + case PageBlockDivider.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDivider(input); + break; + case PageBlockAnchor.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnchor(input); + break; + case PageBlockList.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockList(input); + break; + case PageBlockBlockQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockBlockQuote(input); + break; + case PageBlockPullQuote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPullQuote(input); + break; + case PageBlockAnimation.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAnimation(input); + break; + case PageBlockAudio.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockAudio(input); + break; + case PageBlockPhoto.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockPhoto(input); + break; + case PageBlockVideo.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVideo(input); + break; + case PageBlockVoiceNote.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockVoiceNote(input); + break; + case PageBlockCover.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCover(input); + break; + case PageBlockEmbedded.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbedded(input); + break; + case PageBlockEmbeddedPost.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockEmbeddedPost(input); + break; + case PageBlockCollage.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockCollage(input); + break; + case PageBlockSlideshow.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockSlideshow(input); + break; + case PageBlockChatLink.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockChatLink(input); + break; + case PageBlockTable.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockTable(input); + break; + case PageBlockDetails.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockDetails(input); + break; + case PageBlockRelatedArticles.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockRelatedArticles(input); + break; + case PageBlockMap.CONSTRUCTOR: + this.pageBlocks[i] = new PageBlockMap(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.viewCount = input.readInt(); + this.version = input.readInt(); + this.isRtl = input.readBoolean(); + this.isFull = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.pageBlocks.length); + for (int i = 0; i < this.pageBlocks.length; i++) { + this.pageBlocks[i].serialize(output); + } + output.writeInt(this.viewCount); + output.writeInt(this.version); + output.writeBoolean(this.isRtl); + output.writeBoolean(this.isFull); + } } public static class AcceptCall extends Function { public int callId; public CallProtocol protocol; - public AcceptCall() { - } + public static final int CONSTRUCTOR = -646618416; + + public AcceptCall() {} public AcceptCall(int callId, CallProtocol protocol) { this.callId = callId; this.protocol = protocol; } - public static final int CONSTRUCTOR = -646618416; + public AcceptCall(DataInputStream input) throws IOException { + this.callId = input.readInt(); + if (input.readBoolean()) { + if (CallProtocol.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.protocol = new CallProtocol(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.callId); + if (this.protocol == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.protocol.serialize(output); + } + } } public static class AcceptTermsOfService extends Function { public String termsOfServiceId; - public AcceptTermsOfService() { - } + public static final int CONSTRUCTOR = 2130576356; + + public AcceptTermsOfService() {} public AcceptTermsOfService(String termsOfServiceId) { this.termsOfServiceId = termsOfServiceId; } - public static final int CONSTRUCTOR = 2130576356; + public AcceptTermsOfService(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var termsOfServiceIdTmp = new byte[input.readInt()]; + input.readFully(termsOfServiceIdTmp); + this.termsOfServiceId = new String(termsOfServiceIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.termsOfServiceId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var termsOfServiceIdTmp = this.termsOfServiceId.getBytes(StandardCharsets.UTF_8); + output.writeInt(termsOfServiceIdTmp.length); + output.write(termsOfServiceIdTmp); + } + } } public static class AddChatMember extends Function { @@ -15437,8 +39864,9 @@ public class TdApi { public int userId; public int forwardLimit; - public AddChatMember() { - } + public static final int CONSTRUCTOR = 1182817962; + + public AddChatMember() {} public AddChatMember(long chatId, int userId, int forwardLimit) { this.chatId = chatId; @@ -15446,88 +39874,179 @@ public class TdApi { this.forwardLimit = forwardLimit; } - public static final int CONSTRUCTOR = 1182817962; + public AddChatMember(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userId = input.readInt(); + this.forwardLimit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userId); + output.writeInt(this.forwardLimit); + } } public static class AddChatMembers extends Function { public long chatId; public int[] userIds; - public AddChatMembers() { - } + public static final int CONSTRUCTOR = 1234094617; + + public AddChatMembers() {} public AddChatMembers(long chatId, int[] userIds) { this.chatId = chatId; this.userIds = userIds; } - public static final int CONSTRUCTOR = 1234094617; + public AddChatMembers(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + } } public static class AddContact extends Function { public Contact contact; public boolean sharePhoneNumber; - public AddContact() { - } + public static final int CONSTRUCTOR = 1869640000; + + public AddContact() {} public AddContact(Contact contact, boolean sharePhoneNumber) { this.contact = contact; this.sharePhoneNumber = sharePhoneNumber; } - public static final int CONSTRUCTOR = 1869640000; + public AddContact(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contact = new Contact(input); + } + this.sharePhoneNumber = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.contact == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.contact.serialize(output); + } + output.writeBoolean(this.sharePhoneNumber); + } } public static class AddCustomServerLanguagePack extends Function { public String languagePackId; - public AddCustomServerLanguagePack() { - } + public static final int CONSTRUCTOR = 4492771; + + public AddCustomServerLanguagePack() {} public AddCustomServerLanguagePack(String languagePackId) { this.languagePackId = languagePackId; } - public static final int CONSTRUCTOR = 4492771; + public AddCustomServerLanguagePack(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + } } public static class AddFavoriteSticker extends Function { public InputFile sticker; - public AddFavoriteSticker() { - } + public static final int CONSTRUCTOR = 324504799; + + public AddFavoriteSticker() {} public AddFavoriteSticker(InputFile sticker) { this.sticker = sticker; } - public static final int CONSTRUCTOR = 324504799; + public AddFavoriteSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class AddLocalMessage extends Function { @@ -15537,8 +40056,9 @@ public class TdApi { public boolean disableNotification; public InputMessageContent inputMessageContent; - public AddLocalMessage() { - } + public static final int CONSTRUCTOR = -348943149; + + public AddLocalMessage() {} public AddLocalMessage(long chatId, int senderUserId, long replyToMessageId, boolean disableNotification, InputMessageContent inputMessageContent) { this.chatId = chatId; @@ -15548,50 +40068,168 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -348943149; + public AddLocalMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.senderUserId = input.readInt(); + this.replyToMessageId = input.readLong(); + this.disableNotification = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.senderUserId); + output.writeLong(this.replyToMessageId); + output.writeBoolean(this.disableNotification); + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class AddLogMessage extends Function { public int verbosityLevel; public String text; - public AddLogMessage() { - } + public static final int CONSTRUCTOR = 1597427692; + + public AddLogMessage() {} public AddLogMessage(int verbosityLevel, String text) { this.verbosityLevel = verbosityLevel; this.text = text; } - public static final int CONSTRUCTOR = 1597427692; + public AddLogMessage(DataInputStream input) throws IOException { + this.verbosityLevel = input.readInt(); + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.verbosityLevel); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + } } public static class AddNetworkStatistics extends Function { public NetworkStatisticsEntry entry; - public AddNetworkStatistics() { - } + public static final int CONSTRUCTOR = 1264825305; + + public AddNetworkStatistics() {} public AddNetworkStatistics(NetworkStatisticsEntry entry) { this.entry = entry; } - public static final int CONSTRUCTOR = 1264825305; + public AddNetworkStatistics(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NetworkStatisticsEntryFile.CONSTRUCTOR: + this.entry = new NetworkStatisticsEntryFile(input); + break; + case NetworkStatisticsEntryCall.CONSTRUCTOR: + this.entry = new NetworkStatisticsEntryCall(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.entry == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.entry.serialize(output); + } + } } public static class AddProxy extends Function { @@ -15600,8 +40238,9 @@ public class TdApi { public boolean enable; public ProxyType type; - public AddProxy() { - } + public static final int CONSTRUCTOR = 331529432; + + public AddProxy() {} public AddProxy(String server, int port, boolean enable, ProxyType type) { this.server = server; @@ -15610,68 +40249,177 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = 331529432; + public AddProxy(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var serverTmp = new byte[input.readInt()]; + input.readFully(serverTmp); + this.server = new String(serverTmp, StandardCharsets.UTF_8); + } + this.port = input.readInt(); + this.enable = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ProxyTypeSocks5.CONSTRUCTOR: + this.type = new ProxyTypeSocks5(input); + break; + case ProxyTypeHttp.CONSTRUCTOR: + this.type = new ProxyTypeHttp(input); + break; + case ProxyTypeMtproto.CONSTRUCTOR: + this.type = new ProxyTypeMtproto(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.server == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var serverTmp = this.server.getBytes(StandardCharsets.UTF_8); + output.writeInt(serverTmp.length); + output.write(serverTmp); + } + output.writeInt(this.port); + output.writeBoolean(this.enable); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class AddRecentSticker extends Function { public boolean isAttached; public InputFile sticker; - public AddRecentSticker() { - } + public static final int CONSTRUCTOR = -1478109026; + + public AddRecentSticker() {} public AddRecentSticker(boolean isAttached, InputFile sticker) { this.isAttached = isAttached; this.sticker = sticker; } - public static final int CONSTRUCTOR = -1478109026; + public AddRecentSticker(DataInputStream input) throws IOException { + this.isAttached = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAttached); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class AddRecentlyFoundChat extends Function { public long chatId; - public AddRecentlyFoundChat() { - } + public static final int CONSTRUCTOR = -1746396787; + + public AddRecentlyFoundChat() {} public AddRecentlyFoundChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = -1746396787; + public AddRecentlyFoundChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class AddSavedAnimation extends Function { public InputFile animation; - public AddSavedAnimation() { - } + public static final int CONSTRUCTOR = -1538525088; + + public AddSavedAnimation() {} public AddSavedAnimation(InputFile animation) { this.animation = animation; } - public static final int CONSTRUCTOR = -1538525088; + public AddSavedAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.animation = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.animation = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.animation = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.animation = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + } } public static class AddStickerToSet extends Function { @@ -15679,8 +40427,9 @@ public class TdApi { public String name; public InputSticker sticker; - public AddStickerToSet() { - } + public static final int CONSTRUCTOR = -454661588; + + public AddStickerToSet() {} public AddStickerToSet(int userId, String name, InputSticker sticker) { this.userId = userId; @@ -15688,12 +40437,49 @@ public class TdApi { this.sticker = sticker; } - public static final int CONSTRUCTOR = -454661588; + public AddStickerToSet(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputStickerStatic.CONSTRUCTOR: + this.sticker = new InputStickerStatic(input); + break; + case InputStickerAnimated.CONSTRUCTOR: + this.sticker = new InputStickerAnimated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class AnswerCallbackQuery extends Function { @@ -15703,8 +40489,9 @@ public class TdApi { public String url; public int cacheTime; - public AnswerCallbackQuery() { - } + public static final int CONSTRUCTOR = -1153028490; + + public AnswerCallbackQuery() {} public AnswerCallbackQuery(long callbackQueryId, String text, boolean showAlert, String url, int cacheTime) { this.callbackQueryId = callbackQueryId; @@ -15714,32 +40501,88 @@ public class TdApi { this.cacheTime = cacheTime; } - public static final int CONSTRUCTOR = -1153028490; + public AnswerCallbackQuery(DataInputStream input) throws IOException { + this.callbackQueryId = input.readLong(); + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + this.showAlert = input.readBoolean(); + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.cacheTime = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.callbackQueryId); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + output.writeBoolean(this.showAlert); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeInt(this.cacheTime); + } } public static class AnswerCustomQuery extends Function { public long customQueryId; public String data; - public AnswerCustomQuery() { - } + public static final int CONSTRUCTOR = -1293603521; + + public AnswerCustomQuery() {} public AnswerCustomQuery(long customQueryId, String data) { this.customQueryId = customQueryId; this.data = data; } - public static final int CONSTRUCTOR = -1293603521; + public AnswerCustomQuery(DataInputStream input) throws IOException { + this.customQueryId = input.readLong(); + if (input.readBoolean()) { + var dataTmp = new byte[input.readInt()]; + input.readFully(dataTmp); + this.data = new String(dataTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.customQueryId); + if (this.data == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var dataTmp = this.data.getBytes(StandardCharsets.UTF_8); + output.writeInt(dataTmp.length); + output.write(dataTmp); + } + } } public static class AnswerInlineQuery extends Function { @@ -15751,8 +40594,9 @@ public class TdApi { public String switchPmText; public String switchPmParameter; - public AnswerInlineQuery() { - } + public static final int CONSTRUCTOR = 485879477; + + public AnswerInlineQuery() {} public AnswerInlineQuery(long inlineQueryId, boolean isPersonal, InputInlineQueryResult[] results, int cacheTime, String nextOffset, String switchPmText, String switchPmParameter) { this.inlineQueryId = inlineQueryId; @@ -15764,32 +40608,151 @@ public class TdApi { this.switchPmParameter = switchPmParameter; } - public static final int CONSTRUCTOR = 485879477; + public AnswerInlineQuery(DataInputStream input) throws IOException { + this.inlineQueryId = input.readLong(); + this.isPersonal = input.readBoolean(); + this.results = new InputInlineQueryResult[input.readInt()]; + for (int i = 0; i < this.results.length; i++) { + switch(input.readInt()) { + case InputInlineQueryResultAnimatedGif.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultAnimatedGif(input); + break; + case InputInlineQueryResultAnimatedMpeg4.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultAnimatedMpeg4(input); + break; + case InputInlineQueryResultArticle.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultArticle(input); + break; + case InputInlineQueryResultAudio.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultAudio(input); + break; + case InputInlineQueryResultContact.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultContact(input); + break; + case InputInlineQueryResultDocument.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultDocument(input); + break; + case InputInlineQueryResultGame.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultGame(input); + break; + case InputInlineQueryResultLocation.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultLocation(input); + break; + case InputInlineQueryResultPhoto.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultPhoto(input); + break; + case InputInlineQueryResultSticker.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultSticker(input); + break; + case InputInlineQueryResultVenue.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultVenue(input); + break; + case InputInlineQueryResultVideo.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultVideo(input); + break; + case InputInlineQueryResultVoiceNote.CONSTRUCTOR: + this.results[i] = new InputInlineQueryResultVoiceNote(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.cacheTime = input.readInt(); + if (input.readBoolean()) { + var nextOffsetTmp = new byte[input.readInt()]; + input.readFully(nextOffsetTmp); + this.nextOffset = new String(nextOffsetTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var switchPmTextTmp = new byte[input.readInt()]; + input.readFully(switchPmTextTmp); + this.switchPmText = new String(switchPmTextTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var switchPmParameterTmp = new byte[input.readInt()]; + input.readFully(switchPmParameterTmp); + this.switchPmParameter = new String(switchPmParameterTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.inlineQueryId); + output.writeBoolean(this.isPersonal); + output.writeInt(this.results.length); + for (int i = 0; i < this.results.length; i++) { + this.results[i].serialize(output); + } + output.writeInt(this.cacheTime); + if (this.nextOffset == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nextOffsetTmp = this.nextOffset.getBytes(StandardCharsets.UTF_8); + output.writeInt(nextOffsetTmp.length); + output.write(nextOffsetTmp); + } + if (this.switchPmText == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var switchPmTextTmp = this.switchPmText.getBytes(StandardCharsets.UTF_8); + output.writeInt(switchPmTextTmp.length); + output.write(switchPmTextTmp); + } + if (this.switchPmParameter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var switchPmParameterTmp = this.switchPmParameter.getBytes(StandardCharsets.UTF_8); + output.writeInt(switchPmParameterTmp.length); + output.write(switchPmParameterTmp); + } + } } public static class AnswerPreCheckoutQuery extends Function { public long preCheckoutQueryId; public String errorMessage; - public AnswerPreCheckoutQuery() { - } + public static final int CONSTRUCTOR = -1486789653; + + public AnswerPreCheckoutQuery() {} public AnswerPreCheckoutQuery(long preCheckoutQueryId, String errorMessage) { this.preCheckoutQueryId = preCheckoutQueryId; this.errorMessage = errorMessage; } - public static final int CONSTRUCTOR = -1486789653; + public AnswerPreCheckoutQuery(DataInputStream input) throws IOException { + this.preCheckoutQueryId = input.readLong(); + if (input.readBoolean()) { + var errorMessageTmp = new byte[input.readInt()]; + input.readFully(errorMessageTmp); + this.errorMessage = new String(errorMessageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.preCheckoutQueryId); + if (this.errorMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var errorMessageTmp = this.errorMessage.getBytes(StandardCharsets.UTF_8); + output.writeInt(errorMessageTmp.length); + output.write(errorMessageTmp); + } + } } public static class AnswerShippingQuery extends Function { @@ -15797,8 +40760,9 @@ public class TdApi { public ShippingOption[] shippingOptions; public String errorMessage; - public AnswerShippingQuery() { - } + public static final int CONSTRUCTOR = -434601324; + + public AnswerShippingQuery() {} public AnswerShippingQuery(long shippingQueryId, ShippingOption[] shippingOptions, String errorMessage) { this.shippingQueryId = shippingQueryId; @@ -15806,119 +40770,223 @@ public class TdApi { this.errorMessage = errorMessage; } - public static final int CONSTRUCTOR = -434601324; + public AnswerShippingQuery(DataInputStream input) throws IOException { + this.shippingQueryId = input.readLong(); + this.shippingOptions = new ShippingOption[input.readInt()]; + for (int i = 0; i < this.shippingOptions.length; i++) { + if (ShippingOption.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.shippingOptions[i] = new ShippingOption(input); + } + if (input.readBoolean()) { + var errorMessageTmp = new byte[input.readInt()]; + input.readFully(errorMessageTmp); + this.errorMessage = new String(errorMessageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.shippingQueryId); + output.writeInt(this.shippingOptions.length); + for (int i = 0; i < this.shippingOptions.length; i++) { + this.shippingOptions[i].serialize(output); + } + if (this.errorMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var errorMessageTmp = this.errorMessage.getBytes(StandardCharsets.UTF_8); + output.writeInt(errorMessageTmp.length); + output.write(errorMessageTmp); + } + } } public static class BlockUser extends Function { public int userId; - public BlockUser() { - } + public static final int CONSTRUCTOR = -1239315139; + + public BlockUser() {} public BlockUser(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -1239315139; + public BlockUser(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class CanTransferOwnership extends Function { - - public CanTransferOwnership() { - } - public static final int CONSTRUCTOR = 634602508; - @Override + public CanTransferOwnership() {} + + + public CanTransferOwnership(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CancelDownloadFile extends Function { public int fileId; public boolean onlyIfPending; - public CancelDownloadFile() { - } + public static final int CONSTRUCTOR = -1954524450; + + public CancelDownloadFile() {} public CancelDownloadFile(int fileId, boolean onlyIfPending) { this.fileId = fileId; this.onlyIfPending = onlyIfPending; } - public static final int CONSTRUCTOR = -1954524450; + public CancelDownloadFile(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + this.onlyIfPending = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + output.writeBoolean(this.onlyIfPending); + } } public static class CancelUploadFile extends Function { public int fileId; - public CancelUploadFile() { - } + public static final int CONSTRUCTOR = 1623539600; + + public CancelUploadFile() {} public CancelUploadFile(int fileId) { this.fileId = fileId; } - public static final int CONSTRUCTOR = 1623539600; + public CancelUploadFile(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + } } public static class ChangeImportedContacts extends Function { public Contact[] contacts; - public ChangeImportedContacts() { - } + public static final int CONSTRUCTOR = 1968207955; + + public ChangeImportedContacts() {} public ChangeImportedContacts(Contact[] contacts) { this.contacts = contacts; } - public static final int CONSTRUCTOR = 1968207955; + public ChangeImportedContacts(DataInputStream input) throws IOException { + this.contacts = new Contact[input.readInt()]; + for (int i = 0; i < this.contacts.length; i++) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contacts[i] = new Contact(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.contacts.length); + for (int i = 0; i < this.contacts.length; i++) { + this.contacts[i].serialize(output); + } + } } public static class ChangePhoneNumber extends Function { public String phoneNumber; public PhoneNumberAuthenticationSettings settings; - public ChangePhoneNumber() { - } + public static final int CONSTRUCTOR = -124666973; + + public ChangePhoneNumber() {} public ChangePhoneNumber(String phoneNumber, PhoneNumberAuthenticationSettings settings) { this.phoneNumber = phoneNumber; this.settings = settings; } - public static final int CONSTRUCTOR = -124666973; + public ChangePhoneNumber(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhoneNumberAuthenticationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.settings = new PhoneNumberAuthenticationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.settings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.settings.serialize(output); + } + } } public static class ChangeStickerSet extends Function { @@ -15926,8 +40994,9 @@ public class TdApi { public boolean isInstalled; public boolean isArchived; - public ChangeStickerSet() { - } + public static final int CONSTRUCTOR = 449357293; + + public ChangeStickerSet() {} public ChangeStickerSet(long setId, boolean isInstalled, boolean isArchived) { this.setId = setId; @@ -15935,455 +41004,819 @@ public class TdApi { this.isArchived = isArchived; } - public static final int CONSTRUCTOR = 449357293; + public ChangeStickerSet(DataInputStream input) throws IOException { + this.setId = input.readLong(); + this.isInstalled = input.readBoolean(); + this.isArchived = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.setId); + output.writeBoolean(this.isInstalled); + output.writeBoolean(this.isArchived); + } } public static class CheckAuthenticationBotToken extends Function { public String token; - public CheckAuthenticationBotToken() { - } + public static final int CONSTRUCTOR = 639321206; + + public CheckAuthenticationBotToken() {} public CheckAuthenticationBotToken(String token) { this.token = token; } - public static final int CONSTRUCTOR = 639321206; + public CheckAuthenticationBotToken(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tokenTmp = new byte[input.readInt()]; + input.readFully(tokenTmp); + this.token = new String(tokenTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.token == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tokenTmp = this.token.getBytes(StandardCharsets.UTF_8); + output.writeInt(tokenTmp.length); + output.write(tokenTmp); + } + } } public static class CheckAuthenticationCode extends Function { public String code; - public CheckAuthenticationCode() { - } + public static final int CONSTRUCTOR = -302103382; + + public CheckAuthenticationCode() {} public CheckAuthenticationCode(String code) { this.code = code; } - public static final int CONSTRUCTOR = -302103382; + public CheckAuthenticationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var codeTmp = new byte[input.readInt()]; + input.readFully(codeTmp); + this.code = new String(codeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.code == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var codeTmp = this.code.getBytes(StandardCharsets.UTF_8); + output.writeInt(codeTmp.length); + output.write(codeTmp); + } + } } public static class CheckAuthenticationPassword extends Function { public String password; - public CheckAuthenticationPassword() { - } + public static final int CONSTRUCTOR = -2025698400; + + public CheckAuthenticationPassword() {} public CheckAuthenticationPassword(String password) { this.password = password; } - public static final int CONSTRUCTOR = -2025698400; + public CheckAuthenticationPassword(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class CheckChangePhoneNumberCode extends Function { public String code; - public CheckChangePhoneNumberCode() { - } + public static final int CONSTRUCTOR = -1720278429; + + public CheckChangePhoneNumberCode() {} public CheckChangePhoneNumberCode(String code) { this.code = code; } - public static final int CONSTRUCTOR = -1720278429; + public CheckChangePhoneNumberCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var codeTmp = new byte[input.readInt()]; + input.readFully(codeTmp); + this.code = new String(codeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.code == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var codeTmp = this.code.getBytes(StandardCharsets.UTF_8); + output.writeInt(codeTmp.length); + output.write(codeTmp); + } + } } public static class CheckChatInviteLink extends Function { public String inviteLink; - public CheckChatInviteLink() { - } + public static final int CONSTRUCTOR = -496940997; + + public CheckChatInviteLink() {} public CheckChatInviteLink(String inviteLink) { this.inviteLink = inviteLink; } - public static final int CONSTRUCTOR = -496940997; + public CheckChatInviteLink(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inviteLinkTmp = new byte[input.readInt()]; + input.readFully(inviteLinkTmp); + this.inviteLink = new String(inviteLinkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inviteLink == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inviteLinkTmp = this.inviteLink.getBytes(StandardCharsets.UTF_8); + output.writeInt(inviteLinkTmp.length); + output.write(inviteLinkTmp); + } + } } public static class CheckChatUsername extends Function { public long chatId; public String username; - public CheckChatUsername() { - } + public static final int CONSTRUCTOR = -119119344; + + public CheckChatUsername() {} public CheckChatUsername(long chatId, String username) { this.chatId = chatId; this.username = username; } - public static final int CONSTRUCTOR = -119119344; + public CheckChatUsername(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + } } public static class CheckCreatedPublicChatsLimit extends Function { public PublicChatType type; - public CheckCreatedPublicChatsLimit() { - } + public static final int CONSTRUCTOR = -445546591; + + public CheckCreatedPublicChatsLimit() {} public CheckCreatedPublicChatsLimit(PublicChatType type) { this.type = type; } - public static final int CONSTRUCTOR = -445546591; + public CheckCreatedPublicChatsLimit(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PublicChatTypeHasUsername.CONSTRUCTOR: + this.type = new PublicChatTypeHasUsername(input); + break; + case PublicChatTypeIsLocationBased.CONSTRUCTOR: + this.type = new PublicChatTypeIsLocationBased(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class CheckDatabaseEncryptionKey extends Function { public byte[] encryptionKey; - public CheckDatabaseEncryptionKey() { - } + public static final int CONSTRUCTOR = 1018769307; + + public CheckDatabaseEncryptionKey() {} public CheckDatabaseEncryptionKey(byte[] encryptionKey) { this.encryptionKey = encryptionKey; } - public static final int CONSTRUCTOR = 1018769307; + public CheckDatabaseEncryptionKey(DataInputStream input) throws IOException { + this.encryptionKey = new byte[input.readInt()]; + input.readFully(this.encryptionKey); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.encryptionKey.length); + output.write(this.encryptionKey); + } } public static class CheckEmailAddressVerificationCode extends Function { public String code; - public CheckEmailAddressVerificationCode() { - } + public static final int CONSTRUCTOR = -426386685; + + public CheckEmailAddressVerificationCode() {} public CheckEmailAddressVerificationCode(String code) { this.code = code; } - public static final int CONSTRUCTOR = -426386685; + public CheckEmailAddressVerificationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var codeTmp = new byte[input.readInt()]; + input.readFully(codeTmp); + this.code = new String(codeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.code == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var codeTmp = this.code.getBytes(StandardCharsets.UTF_8); + output.writeInt(codeTmp.length); + output.write(codeTmp); + } + } } public static class CheckPhoneNumberConfirmationCode extends Function { public String code; - public CheckPhoneNumberConfirmationCode() { - } + public static final int CONSTRUCTOR = -1348060966; + + public CheckPhoneNumberConfirmationCode() {} public CheckPhoneNumberConfirmationCode(String code) { this.code = code; } - public static final int CONSTRUCTOR = -1348060966; + public CheckPhoneNumberConfirmationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var codeTmp = new byte[input.readInt()]; + input.readFully(codeTmp); + this.code = new String(codeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.code == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var codeTmp = this.code.getBytes(StandardCharsets.UTF_8); + output.writeInt(codeTmp.length); + output.write(codeTmp); + } + } } public static class CheckPhoneNumberVerificationCode extends Function { public String code; - public CheckPhoneNumberVerificationCode() { - } + public static final int CONSTRUCTOR = 1497462718; + + public CheckPhoneNumberVerificationCode() {} public CheckPhoneNumberVerificationCode(String code) { this.code = code; } - public static final int CONSTRUCTOR = 1497462718; + public CheckPhoneNumberVerificationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var codeTmp = new byte[input.readInt()]; + input.readFully(codeTmp); + this.code = new String(codeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.code == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var codeTmp = this.code.getBytes(StandardCharsets.UTF_8); + output.writeInt(codeTmp.length); + output.write(codeTmp); + } + } } public static class CheckRecoveryEmailAddressCode extends Function { public String code; - public CheckRecoveryEmailAddressCode() { - } + public static final int CONSTRUCTOR = -1997039589; + + public CheckRecoveryEmailAddressCode() {} public CheckRecoveryEmailAddressCode(String code) { this.code = code; } - public static final int CONSTRUCTOR = -1997039589; + public CheckRecoveryEmailAddressCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var codeTmp = new byte[input.readInt()]; + input.readFully(codeTmp); + this.code = new String(codeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.code == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var codeTmp = this.code.getBytes(StandardCharsets.UTF_8); + output.writeInt(codeTmp.length); + output.write(codeTmp); + } + } } public static class CleanFileName extends Function { public String fileName; - public CleanFileName() { - } + public static final int CONSTRUCTOR = 967964667; + + public CleanFileName() {} public CleanFileName(String fileName) { this.fileName = fileName; } - public static final int CONSTRUCTOR = 967964667; + public CleanFileName(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var fileNameTmp = new byte[input.readInt()]; + input.readFully(fileNameTmp); + this.fileName = new String(fileNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fileName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fileNameTmp = this.fileName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fileNameTmp.length); + output.write(fileNameTmp); + } + } } public static class ClearAllDraftMessages extends Function { public boolean excludeSecretChats; - public ClearAllDraftMessages() { - } + public static final int CONSTRUCTOR = -46369573; + + public ClearAllDraftMessages() {} public ClearAllDraftMessages(boolean excludeSecretChats) { this.excludeSecretChats = excludeSecretChats; } - public static final int CONSTRUCTOR = -46369573; + public ClearAllDraftMessages(DataInputStream input) throws IOException { + this.excludeSecretChats = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.excludeSecretChats); + } } public static class ClearImportedContacts extends Function { - - public ClearImportedContacts() { - } - public static final int CONSTRUCTOR = 869503298; - @Override + public ClearImportedContacts() {} + + + public ClearImportedContacts(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ClearRecentStickers extends Function { public boolean isAttached; - public ClearRecentStickers() { - } + public static final int CONSTRUCTOR = -321242684; + + public ClearRecentStickers() {} public ClearRecentStickers(boolean isAttached) { this.isAttached = isAttached; } - public static final int CONSTRUCTOR = -321242684; + public ClearRecentStickers(DataInputStream input) throws IOException { + this.isAttached = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAttached); + } } public static class ClearRecentlyFoundChats extends Function { - - public ClearRecentlyFoundChats() { - } - public static final int CONSTRUCTOR = -285582542; - @Override + public ClearRecentlyFoundChats() {} + + + public ClearRecentlyFoundChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class Close extends Function { - - public Close() { - } - public static final int CONSTRUCTOR = -1187782273; - @Override + public Close() {} + + + public Close(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class CloseChat extends Function { public long chatId; - public CloseChat() { - } + public static final int CONSTRUCTOR = 39749353; + + public CloseChat() {} public CloseChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 39749353; + public CloseChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class CloseSecretChat extends Function { public int secretChatId; - public CloseSecretChat() { - } + public static final int CONSTRUCTOR = -471006133; + + public CloseSecretChat() {} public CloseSecretChat(int secretChatId) { this.secretChatId = secretChatId; } - public static final int CONSTRUCTOR = -471006133; + public CloseSecretChat(DataInputStream input) throws IOException { + this.secretChatId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.secretChatId); + } } public static class ConfirmQrCodeAuthentication extends Function { public String link; - public ConfirmQrCodeAuthentication() { - } + public static final int CONSTRUCTOR = -376199379; + + public ConfirmQrCodeAuthentication() {} public ConfirmQrCodeAuthentication(String link) { this.link = link; } - public static final int CONSTRUCTOR = -376199379; + public ConfirmQrCodeAuthentication(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var linkTmp = new byte[input.readInt()]; + input.readFully(linkTmp); + this.link = new String(linkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.link == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var linkTmp = this.link.getBytes(StandardCharsets.UTF_8); + output.writeInt(linkTmp.length); + output.write(linkTmp); + } + } } public static class CreateBasicGroupChat extends Function { public int basicGroupId; public boolean force; - public CreateBasicGroupChat() { - } + public static final int CONSTRUCTOR = 642492777; + + public CreateBasicGroupChat() {} public CreateBasicGroupChat(int basicGroupId, boolean force) { this.basicGroupId = basicGroupId; this.force = force; } - public static final int CONSTRUCTOR = 642492777; + public CreateBasicGroupChat(DataInputStream input) throws IOException { + this.basicGroupId = input.readInt(); + this.force = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.basicGroupId); + output.writeBoolean(this.force); + } } public static class CreateCall extends Function { public int userId; public CallProtocol protocol; - public CreateCall() { - } + public static final int CONSTRUCTOR = -1742408159; + + public CreateCall() {} public CreateCall(int userId, CallProtocol protocol) { this.userId = userId; this.protocol = protocol; } - public static final int CONSTRUCTOR = -1742408159; + public CreateCall(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + if (CallProtocol.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.protocol = new CallProtocol(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.protocol == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.protocol.serialize(output); + } + } } public static class CreateNewBasicGroupChat extends Function { public int[] userIds; public String title; - public CreateNewBasicGroupChat() { - } + public static final int CONSTRUCTOR = 1874532069; + + public CreateNewBasicGroupChat() {} public CreateNewBasicGroupChat(int[] userIds, String title) { this.userIds = userIds; this.title = title; } - public static final int CONSTRUCTOR = 1874532069; + public CreateNewBasicGroupChat(DataInputStream input) throws IOException { + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class CreateNewSecretChat extends Function { public int userId; - public CreateNewSecretChat() { - } + public static final int CONSTRUCTOR = 1689344881; + + public CreateNewSecretChat() {} public CreateNewSecretChat(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = 1689344881; + public CreateNewSecretChat(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class CreateNewStickerSet extends Function { @@ -16393,8 +41826,9 @@ public class TdApi { public boolean isMasks; public InputSticker[] stickers; - public CreateNewStickerSet() { - } + public static final int CONSTRUCTOR = -1139329506; + + public CreateNewStickerSet() {} public CreateNewStickerSet(int userId, String title, String name, boolean isMasks, InputSticker[] stickers) { this.userId = userId; @@ -16404,12 +41838,63 @@ public class TdApi { this.stickers = stickers; } - public static final int CONSTRUCTOR = -1139329506; + public CreateNewStickerSet(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + this.isMasks = input.readBoolean(); + this.stickers = new InputSticker[input.readInt()]; + for (int i = 0; i < this.stickers.length; i++) { + switch(input.readInt()) { + case InputStickerStatic.CONSTRUCTOR: + this.stickers[i] = new InputStickerStatic(input); + break; + case InputStickerAnimated.CONSTRUCTOR: + this.stickers[i] = new InputStickerAnimated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + output.writeBoolean(this.isMasks); + output.writeInt(this.stickers.length); + for (int i = 0; i < this.stickers.length; i++) { + this.stickers[i].serialize(output); + } + } } public static class CreateNewSupergroupChat extends Function { @@ -16418,8 +41903,9 @@ public class TdApi { public String description; public ChatLocation location; - public CreateNewSupergroupChat() { - } + public static final int CONSTRUCTOR = -8999251; + + public CreateNewSupergroupChat() {} public CreateNewSupergroupChat(String title, boolean isChannel, String description, ChatLocation location) { this.title = title; @@ -16428,108 +41914,215 @@ public class TdApi { this.location = location; } - public static final int CONSTRUCTOR = -8999251; + public CreateNewSupergroupChat(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + this.isChannel = input.readBoolean(); + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (ChatLocation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new ChatLocation(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + output.writeBoolean(this.isChannel); + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + } } public static class CreatePrivateChat extends Function { public int userId; public boolean force; - public CreatePrivateChat() { - } + public static final int CONSTRUCTOR = -1807530364; + + public CreatePrivateChat() {} public CreatePrivateChat(int userId, boolean force) { this.userId = userId; this.force = force; } - public static final int CONSTRUCTOR = -1807530364; + public CreatePrivateChat(DataInputStream input) throws IOException { + this.userId = input.readInt(); + this.force = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + output.writeBoolean(this.force); + } } public static class CreateSecretChat extends Function { public int secretChatId; - public CreateSecretChat() { - } + public static final int CONSTRUCTOR = 1930285615; + + public CreateSecretChat() {} public CreateSecretChat(int secretChatId) { this.secretChatId = secretChatId; } - public static final int CONSTRUCTOR = 1930285615; + public CreateSecretChat(DataInputStream input) throws IOException { + this.secretChatId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.secretChatId); + } } public static class CreateSupergroupChat extends Function { public int supergroupId; public boolean force; - public CreateSupergroupChat() { - } + public static final int CONSTRUCTOR = 352742758; + + public CreateSupergroupChat() {} public CreateSupergroupChat(int supergroupId, boolean force) { this.supergroupId = supergroupId; this.force = force; } - public static final int CONSTRUCTOR = 352742758; + public CreateSupergroupChat(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + this.force = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + output.writeBoolean(this.force); + } } public static class CreateTemporaryPassword extends Function { public String password; public int validFor; - public CreateTemporaryPassword() { - } + public static final int CONSTRUCTOR = -1626509434; + + public CreateTemporaryPassword() {} public CreateTemporaryPassword(String password, int validFor) { this.password = password; this.validFor = validFor; } - public static final int CONSTRUCTOR = -1626509434; + public CreateTemporaryPassword(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + this.validFor = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + output.writeInt(this.validFor); + } } public static class DeleteAccount extends Function { public String reason; - public DeleteAccount() { - } + public static final int CONSTRUCTOR = -1203056508; + + public DeleteAccount() {} public DeleteAccount(String reason) { this.reason = reason; } - public static final int CONSTRUCTOR = -1203056508; + public DeleteAccount(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var reasonTmp = new byte[input.readInt()]; + input.readFully(reasonTmp); + this.reason = new String(reasonTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.reason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var reasonTmp = this.reason.getBytes(StandardCharsets.UTF_8); + output.writeInt(reasonTmp.length); + output.write(reasonTmp); + } + } } public static class DeleteChatHistory extends Function { @@ -16537,8 +42130,9 @@ public class TdApi { public boolean removeFromChatList; public boolean revoke; - public DeleteChatHistory() { - } + public static final int CONSTRUCTOR = -1472081761; + + public DeleteChatHistory() {} public DeleteChatHistory(long chatId, boolean removeFromChatList, boolean revoke) { this.chatId = chatId; @@ -16546,88 +42140,141 @@ public class TdApi { this.revoke = revoke; } - public static final int CONSTRUCTOR = -1472081761; + public DeleteChatHistory(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.removeFromChatList = input.readBoolean(); + this.revoke = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.removeFromChatList); + output.writeBoolean(this.revoke); + } } public static class DeleteChatMessagesFromUser extends Function { public long chatId; public int userId; - public DeleteChatMessagesFromUser() { - } + public static final int CONSTRUCTOR = -1599689199; + + public DeleteChatMessagesFromUser() {} public DeleteChatMessagesFromUser(long chatId, int userId) { this.chatId = chatId; this.userId = userId; } - public static final int CONSTRUCTOR = -1599689199; + public DeleteChatMessagesFromUser(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userId); + } } public static class DeleteChatReplyMarkup extends Function { public long chatId; public long messageId; - public DeleteChatReplyMarkup() { - } + public static final int CONSTRUCTOR = 100637531; + + public DeleteChatReplyMarkup() {} public DeleteChatReplyMarkup(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = 100637531; + public DeleteChatReplyMarkup(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class DeleteFile extends Function { public int fileId; - public DeleteFile() { - } + public static final int CONSTRUCTOR = 1807653676; + + public DeleteFile() {} public DeleteFile(int fileId) { this.fileId = fileId; } - public static final int CONSTRUCTOR = 1807653676; + public DeleteFile(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + } } public static class DeleteLanguagePack extends Function { public String languagePackId; - public DeleteLanguagePack() { - } + public static final int CONSTRUCTOR = -2108761026; + + public DeleteLanguagePack() {} public DeleteLanguagePack(String languagePackId) { this.languagePackId = languagePackId; } - public static final int CONSTRUCTOR = -2108761026; + public DeleteLanguagePack(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + } } public static class DeleteMessages extends Function { @@ -16635,8 +42282,9 @@ public class TdApi { public long[] messageIds; public boolean revoke; - public DeleteMessages() { - } + public static final int CONSTRUCTOR = 1130090173; + + public DeleteMessages() {} public DeleteMessages(long chatId, long[] messageIds, boolean revoke) { this.chatId = chatId; @@ -16644,118 +42292,224 @@ public class TdApi { this.revoke = revoke; } - public static final int CONSTRUCTOR = 1130090173; + public DeleteMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + this.revoke = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + output.writeBoolean(this.revoke); + } } public static class DeletePassportElement extends Function { public PassportElementType type; - public DeletePassportElement() { - } + public static final int CONSTRUCTOR = -1719555468; + + public DeletePassportElement() {} public DeletePassportElement(PassportElementType type) { this.type = type; } - public static final int CONSTRUCTOR = -1719555468; + public DeletePassportElement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.type = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.type = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.type = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.type = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.type = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.type = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.type = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.type = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.type = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.type = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.type = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.type = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.type = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class DeleteProfilePhoto extends Function { public long profilePhotoId; - public DeleteProfilePhoto() { - } + public static final int CONSTRUCTOR = 1319794625; + + public DeleteProfilePhoto() {} public DeleteProfilePhoto(long profilePhotoId) { this.profilePhotoId = profilePhotoId; } - public static final int CONSTRUCTOR = 1319794625; + public DeleteProfilePhoto(DataInputStream input) throws IOException { + this.profilePhotoId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.profilePhotoId); + } } public static class DeleteSavedCredentials extends Function { - - public DeleteSavedCredentials() { - } - public static final int CONSTRUCTOR = 826300114; - @Override + public DeleteSavedCredentials() {} + + + public DeleteSavedCredentials(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class DeleteSavedOrderInfo extends Function { - - public DeleteSavedOrderInfo() { - } - public static final int CONSTRUCTOR = 1629058164; - @Override + public DeleteSavedOrderInfo() {} + + + public DeleteSavedOrderInfo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class DeleteSupergroup extends Function { public int supergroupId; - public DeleteSupergroup() { - } + public static final int CONSTRUCTOR = -1999855965; + + public DeleteSupergroup() {} public DeleteSupergroup(int supergroupId) { this.supergroupId = supergroupId; } - public static final int CONSTRUCTOR = -1999855965; + public DeleteSupergroup(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + } } public static class Destroy extends Function { - - public Destroy() { - } - public static final int CONSTRUCTOR = 685331274; - @Override + public Destroy() {} + + + public Destroy(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class DisableProxy extends Function { - - public DisableProxy() { - } - public static final int CONSTRUCTOR = -2100095102; - @Override + public DisableProxy() {} + + + public DisableProxy(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class DiscardCall extends Function { @@ -16764,8 +42518,9 @@ public class TdApi { public int duration; public long connectionId; - public DiscardCall() { - } + public static final int CONSTRUCTOR = -923187372; + + public DiscardCall() {} public DiscardCall(int callId, boolean isDisconnected, int duration, long connectionId) { this.callId = callId; @@ -16774,43 +42529,67 @@ public class TdApi { this.connectionId = connectionId; } - public static final int CONSTRUCTOR = -923187372; + public DiscardCall(DataInputStream input) throws IOException { + this.callId = input.readInt(); + this.isDisconnected = input.readBoolean(); + this.duration = input.readInt(); + this.connectionId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.callId); + output.writeBoolean(this.isDisconnected); + output.writeInt(this.duration); + output.writeLong(this.connectionId); + } } public static class DisconnectAllWebsites extends Function { - - public DisconnectAllWebsites() { - } - public static final int CONSTRUCTOR = -1082985981; - @Override + public DisconnectAllWebsites() {} + + + public DisconnectAllWebsites(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class DisconnectWebsite extends Function { public long websiteId; - public DisconnectWebsite() { - } + public static final int CONSTRUCTOR = -778767395; + + public DisconnectWebsite() {} public DisconnectWebsite(long websiteId) { this.websiteId = websiteId; } - public static final int CONSTRUCTOR = -778767395; + public DisconnectWebsite(DataInputStream input) throws IOException { + this.websiteId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.websiteId); + } } public static class DownloadFile extends Function { @@ -16820,8 +42599,9 @@ public class TdApi { public int limit; public boolean synchronous; - public DownloadFile() { - } + public static final int CONSTRUCTOR = -1102026662; + + public DownloadFile() {} public DownloadFile(int fileId, int priority, int offset, int limit, boolean synchronous) { this.fileId = fileId; @@ -16831,30 +42611,61 @@ public class TdApi { this.synchronous = synchronous; } - public static final int CONSTRUCTOR = -1102026662; + public DownloadFile(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + this.priority = input.readInt(); + this.offset = input.readInt(); + this.limit = input.readInt(); + this.synchronous = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + output.writeInt(this.priority); + output.writeInt(this.offset); + output.writeInt(this.limit); + output.writeBoolean(this.synchronous); + } } public static class EditCustomLanguagePackInfo extends Function { public LanguagePackInfo info; - public EditCustomLanguagePackInfo() { - } + public static final int CONSTRUCTOR = 1320751257; + + public EditCustomLanguagePackInfo() {} public EditCustomLanguagePackInfo(LanguagePackInfo info) { this.info = info; } - public static final int CONSTRUCTOR = 1320751257; + public EditCustomLanguagePackInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (LanguagePackInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.info = new LanguagePackInfo(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.info == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.info.serialize(output); + } + } } public static class EditInlineMessageCaption extends Function { @@ -16862,8 +42673,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public FormattedText caption; - public EditInlineMessageCaption() { - } + public static final int CONSTRUCTOR = -760985929; + + public EditInlineMessageCaption() {} public EditInlineMessageCaption(String inlineMessageId, ReplyMarkup replyMarkup, FormattedText caption) { this.inlineMessageId = inlineMessageId; @@ -16871,12 +42683,65 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = -760985929; + public EditInlineMessageCaption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class EditInlineMessageLiveLocation extends Function { @@ -16884,8 +42749,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public Location location; - public EditInlineMessageLiveLocation() { - } + public static final int CONSTRUCTOR = 655046316; + + public EditInlineMessageLiveLocation() {} public EditInlineMessageLiveLocation(String inlineMessageId, ReplyMarkup replyMarkup, Location location) { this.inlineMessageId = inlineMessageId; @@ -16893,12 +42759,65 @@ public class TdApi { this.location = location; } - public static final int CONSTRUCTOR = 655046316; + public EditInlineMessageLiveLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + } } public static class EditInlineMessageMedia extends Function { @@ -16906,8 +42825,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public EditInlineMessageMedia() { - } + public static final int CONSTRUCTOR = 23553921; + + public EditInlineMessageMedia() {} public EditInlineMessageMedia(String inlineMessageId, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.inlineMessageId = inlineMessageId; @@ -16915,32 +42835,178 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 23553921; + public EditInlineMessageMedia(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class EditInlineMessageReplyMarkup extends Function { public String inlineMessageId; public ReplyMarkup replyMarkup; - public EditInlineMessageReplyMarkup() { - } + public static final int CONSTRUCTOR = -67565858; + + public EditInlineMessageReplyMarkup() {} public EditInlineMessageReplyMarkup(String inlineMessageId, ReplyMarkup replyMarkup) { this.inlineMessageId = inlineMessageId; this.replyMarkup = replyMarkup; } - public static final int CONSTRUCTOR = -67565858; + public EditInlineMessageReplyMarkup(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + } } public static class EditInlineMessageText extends Function { @@ -16948,8 +43014,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public EditInlineMessageText() { - } + public static final int CONSTRUCTOR = -855457307; + + public EditInlineMessageText() {} public EditInlineMessageText(String inlineMessageId, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.inlineMessageId = inlineMessageId; @@ -16957,12 +43024,116 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -855457307; + public EditInlineMessageText(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class EditMessageCaption extends Function { @@ -16971,8 +43142,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public FormattedText caption; - public EditMessageCaption() { - } + public static final int CONSTRUCTOR = 1154677038; + + public EditMessageCaption() {} public EditMessageCaption(long chatId, long messageId, ReplyMarkup replyMarkup, FormattedText caption) { this.chatId = chatId; @@ -16981,12 +43153,56 @@ public class TdApi { this.caption = caption; } - public static final int CONSTRUCTOR = 1154677038; + public EditMessageCaption(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.caption = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.caption == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.caption.serialize(output); + } + } } public static class EditMessageLiveLocation extends Function { @@ -16995,8 +43211,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public Location location; - public EditMessageLiveLocation() { - } + public static final int CONSTRUCTOR = -1146772745; + + public EditMessageLiveLocation() {} public EditMessageLiveLocation(long chatId, long messageId, ReplyMarkup replyMarkup, Location location) { this.chatId = chatId; @@ -17005,12 +43222,56 @@ public class TdApi { this.location = location; } - public static final int CONSTRUCTOR = -1146772745; + public EditMessageLiveLocation(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + } } public static class EditMessageMedia extends Function { @@ -17019,8 +43280,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public EditMessageMedia() { - } + public static final int CONSTRUCTOR = -1152678125; + + public EditMessageMedia() {} public EditMessageMedia(long chatId, long messageId, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.chatId = chatId; @@ -17029,12 +43291,107 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -1152678125; + public EditMessageMedia(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class EditMessageReplyMarkup extends Function { @@ -17042,8 +43399,9 @@ public class TdApi { public long messageId; public ReplyMarkup replyMarkup; - public EditMessageReplyMarkup() { - } + public static final int CONSTRUCTOR = 332127881; + + public EditMessageReplyMarkup() {} public EditMessageReplyMarkup(long chatId, long messageId, ReplyMarkup replyMarkup) { this.chatId = chatId; @@ -17051,12 +43409,44 @@ public class TdApi { this.replyMarkup = replyMarkup; } - public static final int CONSTRUCTOR = 332127881; + public EditMessageReplyMarkup(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + } } public static class EditMessageSchedulingState extends Function { @@ -17064,8 +43454,9 @@ public class TdApi { public long messageId; public MessageSchedulingState schedulingState; - public EditMessageSchedulingState() { - } + public static final int CONSTRUCTOR = -1372976192; + + public EditMessageSchedulingState() {} public EditMessageSchedulingState(long chatId, long messageId, MessageSchedulingState schedulingState) { this.chatId = chatId; @@ -17073,12 +43464,38 @@ public class TdApi { this.schedulingState = schedulingState; } - public static final int CONSTRUCTOR = -1372976192; + public EditMessageSchedulingState(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case MessageSchedulingStateSendAtDate.CONSTRUCTOR: + this.schedulingState = new MessageSchedulingStateSendAtDate(input); + break; + case MessageSchedulingStateSendWhenOnline.CONSTRUCTOR: + this.schedulingState = new MessageSchedulingStateSendWhenOnline(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.schedulingState == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.schedulingState.serialize(output); + } + } } public static class EditMessageText extends Function { @@ -17087,8 +43504,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public EditMessageText() { - } + public static final int CONSTRUCTOR = 196272567; + + public EditMessageText() {} public EditMessageText(long chatId, long messageId, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.chatId = chatId; @@ -17097,12 +43515,107 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = 196272567; + public EditMessageText(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class EditProxy extends Function { @@ -17112,8 +43625,9 @@ public class TdApi { public boolean enable; public ProxyType type; - public EditProxy() { - } + public static final int CONSTRUCTOR = -1605883821; + + public EditProxy() {} public EditProxy(int proxyId, String server, int port, boolean enable, ProxyType type) { this.proxyId = proxyId; @@ -17123,50 +43637,120 @@ public class TdApi { this.type = type; } - public static final int CONSTRUCTOR = -1605883821; + public EditProxy(DataInputStream input) throws IOException { + this.proxyId = input.readInt(); + if (input.readBoolean()) { + var serverTmp = new byte[input.readInt()]; + input.readFully(serverTmp); + this.server = new String(serverTmp, StandardCharsets.UTF_8); + } + this.port = input.readInt(); + this.enable = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ProxyTypeSocks5.CONSTRUCTOR: + this.type = new ProxyTypeSocks5(input); + break; + case ProxyTypeHttp.CONSTRUCTOR: + this.type = new ProxyTypeHttp(input); + break; + case ProxyTypeMtproto.CONSTRUCTOR: + this.type = new ProxyTypeMtproto(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.proxyId); + if (this.server == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var serverTmp = this.server.getBytes(StandardCharsets.UTF_8); + output.writeInt(serverTmp.length); + output.write(serverTmp); + } + output.writeInt(this.port); + output.writeBoolean(this.enable); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class EnableProxy extends Function { public int proxyId; - public EnableProxy() { - } + public static final int CONSTRUCTOR = 1494450838; + + public EnableProxy() {} public EnableProxy(int proxyId) { this.proxyId = proxyId; } - public static final int CONSTRUCTOR = 1494450838; + public EnableProxy(DataInputStream input) throws IOException { + this.proxyId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.proxyId); + } } public static class FinishFileGeneration extends Function { public long generationId; public Error error; - public FinishFileGeneration() { - } + public static final int CONSTRUCTOR = -1055060835; + + public FinishFileGeneration() {} public FinishFileGeneration(long generationId, Error error) { this.generationId = generationId; this.error = error; } - public static final int CONSTRUCTOR = -1055060835; + public FinishFileGeneration(DataInputStream input) throws IOException { + this.generationId = input.readLong(); + if (input.readBoolean()) { + if (Error.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.error = new Error(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.generationId); + if (this.error == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.error.serialize(output); + } + } } public static class ForwardMessages extends Function { @@ -17178,8 +43762,9 @@ public class TdApi { public boolean sendCopy; public boolean removeCaption; - public ForwardMessages() { - } + public static final int CONSTRUCTOR = -1633531094; + + public ForwardMessages() {} public ForwardMessages(long chatId, long fromChatId, long[] messageIds, SendMessageOptions options, boolean asAlbum, boolean sendCopy, boolean removeCaption) { this.chatId = chatId; @@ -17191,100 +43776,179 @@ public class TdApi { this.removeCaption = removeCaption; } - public static final int CONSTRUCTOR = -1633531094; + public ForwardMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.fromChatId = input.readLong(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + if (input.readBoolean()) { + if (SendMessageOptions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.options = new SendMessageOptions(input); + } + this.asAlbum = input.readBoolean(); + this.sendCopy = input.readBoolean(); + this.removeCaption = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.fromChatId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + if (this.options == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.options.serialize(output); + } + output.writeBoolean(this.asAlbum); + output.writeBoolean(this.sendCopy); + output.writeBoolean(this.removeCaption); + } } public static class GenerateChatInviteLink extends Function { public long chatId; - public GenerateChatInviteLink() { - } + public static final int CONSTRUCTOR = 1945532500; + + public GenerateChatInviteLink() {} public GenerateChatInviteLink(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 1945532500; + public GenerateChatInviteLink(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class GetAccountTtl extends Function { - - public GetAccountTtl() { - } - public static final int CONSTRUCTOR = -443905161; - @Override + public GetAccountTtl() {} + + + public GetAccountTtl(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetActiveLiveLocationMessages extends Function { - - public GetActiveLiveLocationMessages() { - } - public static final int CONSTRUCTOR = -1425459567; - @Override + public GetActiveLiveLocationMessages() {} + + + public GetActiveLiveLocationMessages(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetActiveSessions extends Function { - - public GetActiveSessions() { - } - public static final int CONSTRUCTOR = 1119710526; - @Override + public GetActiveSessions() {} + + + public GetActiveSessions(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetAllPassportElements extends Function { public String password; - public GetAllPassportElements() { - } + public static final int CONSTRUCTOR = -2038945045; + + public GetAllPassportElements() {} public GetAllPassportElements(String password) { this.password = password; } - public static final int CONSTRUCTOR = -2038945045; + public GetAllPassportElements(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class GetApplicationConfig extends Function { - - public GetApplicationConfig() { - } - public static final int CONSTRUCTOR = -1823144318; - @Override + public GetApplicationConfig() {} + + + public GetApplicationConfig(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetArchivedStickerSets extends Function { @@ -17292,8 +43956,9 @@ public class TdApi { public long offsetStickerSetId; public int limit; - public GetArchivedStickerSets() { - } + public static final int CONSTRUCTOR = 1996943238; + + public GetArchivedStickerSets() {} public GetArchivedStickerSets(boolean isMasks, long offsetStickerSetId, int limit) { this.isMasks = isMasks; @@ -17301,168 +43966,282 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = 1996943238; + public GetArchivedStickerSets(DataInputStream input) throws IOException { + this.isMasks = input.readBoolean(); + this.offsetStickerSetId = input.readLong(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isMasks); + output.writeLong(this.offsetStickerSetId); + output.writeInt(this.limit); + } } public static class GetAttachedStickerSets extends Function { public int fileId; - public GetAttachedStickerSets() { - } + public static final int CONSTRUCTOR = 1302172429; + + public GetAttachedStickerSets() {} public GetAttachedStickerSets(int fileId) { this.fileId = fileId; } - public static final int CONSTRUCTOR = 1302172429; + public GetAttachedStickerSets(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + } } public static class GetAuthorizationState extends Function { - - public GetAuthorizationState() { - } - public static final int CONSTRUCTOR = 1949154877; - @Override + public GetAuthorizationState() {} + + + public GetAuthorizationState(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetAutoDownloadSettingsPresets extends Function { - - public GetAutoDownloadSettingsPresets() { - } - public static final int CONSTRUCTOR = -1721088201; - @Override + public GetAutoDownloadSettingsPresets() {} + + + public GetAutoDownloadSettingsPresets(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetBackgroundUrl extends Function { public String name; public BackgroundType type; - public GetBackgroundUrl() { - } + public static final int CONSTRUCTOR = 733769682; + + public GetBackgroundUrl() {} public GetBackgroundUrl(String name, BackgroundType type) { this.name = name; this.type = type; } - public static final int CONSTRUCTOR = 733769682; + public GetBackgroundUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case BackgroundTypeWallpaper.CONSTRUCTOR: + this.type = new BackgroundTypeWallpaper(input); + break; + case BackgroundTypePattern.CONSTRUCTOR: + this.type = new BackgroundTypePattern(input); + break; + case BackgroundTypeFill.CONSTRUCTOR: + this.type = new BackgroundTypeFill(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class GetBackgrounds extends Function { public boolean forDarkTheme; - public GetBackgrounds() { - } + public static final int CONSTRUCTOR = 249072633; + + public GetBackgrounds() {} public GetBackgrounds(boolean forDarkTheme) { this.forDarkTheme = forDarkTheme; } - public static final int CONSTRUCTOR = 249072633; + public GetBackgrounds(DataInputStream input) throws IOException { + this.forDarkTheme = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.forDarkTheme); + } } public static class GetBankCardInfo extends Function { public String bankCardNumber; - public GetBankCardInfo() { - } + public static final int CONSTRUCTOR = -1310515792; + + public GetBankCardInfo() {} public GetBankCardInfo(String bankCardNumber) { this.bankCardNumber = bankCardNumber; } - public static final int CONSTRUCTOR = -1310515792; + public GetBankCardInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var bankCardNumberTmp = new byte[input.readInt()]; + input.readFully(bankCardNumberTmp); + this.bankCardNumber = new String(bankCardNumberTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.bankCardNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var bankCardNumberTmp = this.bankCardNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(bankCardNumberTmp.length); + output.write(bankCardNumberTmp); + } + } } public static class GetBasicGroup extends Function { public int basicGroupId; - public GetBasicGroup() { - } + public static final int CONSTRUCTOR = 561775568; + + public GetBasicGroup() {} public GetBasicGroup(int basicGroupId) { this.basicGroupId = basicGroupId; } - public static final int CONSTRUCTOR = 561775568; + public GetBasicGroup(DataInputStream input) throws IOException { + this.basicGroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.basicGroupId); + } } public static class GetBasicGroupFullInfo extends Function { public int basicGroupId; - public GetBasicGroupFullInfo() { - } + public static final int CONSTRUCTOR = 1770517905; + + public GetBasicGroupFullInfo() {} public GetBasicGroupFullInfo(int basicGroupId) { this.basicGroupId = basicGroupId; } - public static final int CONSTRUCTOR = 1770517905; + public GetBasicGroupFullInfo(DataInputStream input) throws IOException { + this.basicGroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.basicGroupId); + } } public static class GetBlockedUsers extends Function { public int offset; public int limit; - public GetBlockedUsers() { - } + public static final int CONSTRUCTOR = -742912777; + + public GetBlockedUsers() {} public GetBlockedUsers(int offset, int limit) { this.offset = offset; this.limit = limit; } - public static final int CONSTRUCTOR = -742912777; + public GetBlockedUsers(DataInputStream input) throws IOException { + this.offset = input.readInt(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.offset); + output.writeInt(this.limit); + } } public static class GetCallbackQueryAnswer extends Function { @@ -17470,8 +44249,9 @@ public class TdApi { public long messageId; public CallbackQueryPayload payload; - public GetCallbackQueryAnswer() { - } + public static final int CONSTRUCTOR = 116357727; + + public GetCallbackQueryAnswer() {} public GetCallbackQueryAnswer(long chatId, long messageId, CallbackQueryPayload payload) { this.chatId = chatId; @@ -17479,48 +44259,88 @@ public class TdApi { this.payload = payload; } - public static final int CONSTRUCTOR = 116357727; + public GetCallbackQueryAnswer(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case CallbackQueryPayloadData.CONSTRUCTOR: + this.payload = new CallbackQueryPayloadData(input); + break; + case CallbackQueryPayloadGame.CONSTRUCTOR: + this.payload = new CallbackQueryPayloadGame(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.payload == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.payload.serialize(output); + } + } } public static class GetChat extends Function { public long chatId; - public GetChat() { - } + public static final int CONSTRUCTOR = 1866601536; + + public GetChat() {} public GetChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 1866601536; + public GetChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class GetChatAdministrators extends Function { public long chatId; - public GetChatAdministrators() { - } + public static final int CONSTRUCTOR = 1544468155; + + public GetChatAdministrators() {} public GetChatAdministrators(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 1544468155; + public GetChatAdministrators(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class GetChatEventLog extends Function { @@ -17531,8 +44351,9 @@ public class TdApi { public ChatEventLogFilters filters; public int[] userIds; - public GetChatEventLog() { - } + public static final int CONSTRUCTOR = 206900967; + + public GetChatEventLog() {} public GetChatEventLog(long chatId, String query, long fromEventId, int limit, ChatEventLogFilters filters, int[] userIds) { this.chatId = chatId; @@ -17543,12 +44364,55 @@ public class TdApi { this.userIds = userIds; } - public static final int CONSTRUCTOR = 206900967; + public GetChatEventLog(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.fromEventId = input.readLong(); + this.limit = input.readInt(); + if (input.readBoolean()) { + if (ChatEventLogFilters.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.filters = new ChatEventLogFilters(input); + } + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeLong(this.fromEventId); + output.writeInt(this.limit); + if (this.filters == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.filters.serialize(output); + } + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + } } public static class GetChatHistory extends Function { @@ -17558,8 +44422,9 @@ public class TdApi { public int limit; public boolean onlyLocal; - public GetChatHistory() { - } + public static final int CONSTRUCTOR = -799960451; + + public GetChatHistory() {} public GetChatHistory(long chatId, long fromMessageId, int offset, int limit, boolean onlyLocal) { this.chatId = chatId; @@ -17569,52 +44434,84 @@ public class TdApi { this.onlyLocal = onlyLocal; } - public static final int CONSTRUCTOR = -799960451; + public GetChatHistory(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.fromMessageId = input.readLong(); + this.offset = input.readInt(); + this.limit = input.readInt(); + this.onlyLocal = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.fromMessageId); + output.writeInt(this.offset); + output.writeInt(this.limit); + output.writeBoolean(this.onlyLocal); + } } public static class GetChatMember extends Function { public long chatId; public int userId; - public GetChatMember() { - } + public static final int CONSTRUCTOR = 677085892; + + public GetChatMember() {} public GetChatMember(long chatId, int userId) { this.chatId = chatId; this.userId = userId; } - public static final int CONSTRUCTOR = 677085892; + public GetChatMember(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userId); + } } public static class GetChatMessageByDate extends Function { public long chatId; public int date; - public GetChatMessageByDate() { - } + public static final int CONSTRUCTOR = 1062564150; + + public GetChatMessageByDate() {} public GetChatMessageByDate(long chatId, int date) { this.chatId = chatId; this.date = date; } - public static final int CONSTRUCTOR = 1062564150; + public GetChatMessageByDate(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.date = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.date); + } } public static class GetChatMessageCount extends Function { @@ -17622,8 +44519,9 @@ public class TdApi { public SearchMessagesFilter filter; public boolean returnLocal; - public GetChatMessageCount() { - } + public static final int CONSTRUCTOR = 205435308; + + public GetChatMessageCount() {} public GetChatMessageCount(long chatId, SearchMessagesFilter filter, boolean returnLocal) { this.chatId = chatId; @@ -17631,88 +44529,207 @@ public class TdApi { this.returnLocal = returnLocal; } - public static final int CONSTRUCTOR = 205435308; + public GetChatMessageCount(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case SearchMessagesFilterEmpty.CONSTRUCTOR: + this.filter = new SearchMessagesFilterEmpty(input); + break; + case SearchMessagesFilterAnimation.CONSTRUCTOR: + this.filter = new SearchMessagesFilterAnimation(input); + break; + case SearchMessagesFilterAudio.CONSTRUCTOR: + this.filter = new SearchMessagesFilterAudio(input); + break; + case SearchMessagesFilterDocument.CONSTRUCTOR: + this.filter = new SearchMessagesFilterDocument(input); + break; + case SearchMessagesFilterPhoto.CONSTRUCTOR: + this.filter = new SearchMessagesFilterPhoto(input); + break; + case SearchMessagesFilterVideo.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVideo(input); + break; + case SearchMessagesFilterVoiceNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVoiceNote(input); + break; + case SearchMessagesFilterPhotoAndVideo.CONSTRUCTOR: + this.filter = new SearchMessagesFilterPhotoAndVideo(input); + break; + case SearchMessagesFilterUrl.CONSTRUCTOR: + this.filter = new SearchMessagesFilterUrl(input); + break; + case SearchMessagesFilterChatPhoto.CONSTRUCTOR: + this.filter = new SearchMessagesFilterChatPhoto(input); + break; + case SearchMessagesFilterCall.CONSTRUCTOR: + this.filter = new SearchMessagesFilterCall(input); + break; + case SearchMessagesFilterMissedCall.CONSTRUCTOR: + this.filter = new SearchMessagesFilterMissedCall(input); + break; + case SearchMessagesFilterVideoNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVideoNote(input); + break; + case SearchMessagesFilterVoiceAndVideoNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVoiceAndVideoNote(input); + break; + case SearchMessagesFilterMention.CONSTRUCTOR: + this.filter = new SearchMessagesFilterMention(input); + break; + case SearchMessagesFilterUnreadMention.CONSTRUCTOR: + this.filter = new SearchMessagesFilterUnreadMention(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.returnLocal = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.filter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.filter.serialize(output); + } + output.writeBoolean(this.returnLocal); + } } public static class GetChatNotificationSettingsExceptions extends Function { public NotificationSettingsScope scope; public boolean compareSound; - public GetChatNotificationSettingsExceptions() { - } + public static final int CONSTRUCTOR = 201199121; + + public GetChatNotificationSettingsExceptions() {} public GetChatNotificationSettingsExceptions(NotificationSettingsScope scope, boolean compareSound) { this.scope = scope; this.compareSound = compareSound; } - public static final int CONSTRUCTOR = 201199121; + public GetChatNotificationSettingsExceptions(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationSettingsScopePrivateChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopePrivateChats(input); + break; + case NotificationSettingsScopeGroupChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeGroupChats(input); + break; + case NotificationSettingsScopeChannelChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeChannelChats(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.compareSound = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.scope == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.scope.serialize(output); + } + output.writeBoolean(this.compareSound); + } } public static class GetChatPinnedMessage extends Function { public long chatId; - public GetChatPinnedMessage() { - } + public static final int CONSTRUCTOR = 359865008; + + public GetChatPinnedMessage() {} public GetChatPinnedMessage(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 359865008; + public GetChatPinnedMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class GetChatScheduledMessages extends Function { public long chatId; - public GetChatScheduledMessages() { - } + public static final int CONSTRUCTOR = -549638149; + + public GetChatScheduledMessages() {} public GetChatScheduledMessages(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = -549638149; + public GetChatScheduledMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class GetChatStatistics extends Function { public long chatId; public boolean isDark; - public GetChatStatistics() { - } + public static final int CONSTRUCTOR = 327057816; + + public GetChatStatistics() {} public GetChatStatistics(long chatId, boolean isDark) { this.chatId = chatId; this.isDark = isDark; } - public static final int CONSTRUCTOR = 327057816; + public GetChatStatistics(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.isDark = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.isDark); + } } public static class GetChatStatisticsGraph extends Function { @@ -17720,8 +44737,9 @@ public class TdApi { public String token; public long x; - public GetChatStatisticsGraph() { - } + public static final int CONSTRUCTOR = -1643545293; + + public GetChatStatisticsGraph() {} public GetChatStatisticsGraph(long chatId, String token, long x) { this.chatId = chatId; @@ -17729,12 +44747,33 @@ public class TdApi { this.x = x; } - public static final int CONSTRUCTOR = -1643545293; + public GetChatStatisticsGraph(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var tokenTmp = new byte[input.readInt()]; + input.readFully(tokenTmp); + this.token = new String(tokenTmp, StandardCharsets.UTF_8); + } + this.x = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.token == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tokenTmp = this.token.getBytes(StandardCharsets.UTF_8); + output.writeInt(tokenTmp.length); + output.write(tokenTmp); + } + output.writeLong(this.x); + } } public static class GetChatStatisticsUrl extends Function { @@ -17742,8 +44781,9 @@ public class TdApi { public String parameters; public boolean isDark; - public GetChatStatisticsUrl() { - } + public static final int CONSTRUCTOR = 1114621183; + + public GetChatStatisticsUrl() {} public GetChatStatisticsUrl(long chatId, String parameters, boolean isDark) { this.chatId = chatId; @@ -17751,12 +44791,33 @@ public class TdApi { this.isDark = isDark; } - public static final int CONSTRUCTOR = 1114621183; + public GetChatStatisticsUrl(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var parametersTmp = new byte[input.readInt()]; + input.readFully(parametersTmp); + this.parameters = new String(parametersTmp, StandardCharsets.UTF_8); + } + this.isDark = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.parameters == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var parametersTmp = this.parameters.getBytes(StandardCharsets.UTF_8); + output.writeInt(parametersTmp.length); + output.write(parametersTmp); + } + output.writeBoolean(this.isDark); + } } public static class GetChats extends Function { @@ -17765,8 +44826,9 @@ public class TdApi { public long offsetChatId; public int limit; - public GetChats() { - } + public static final int CONSTRUCTOR = 1847129537; + + public GetChats() {} public GetChats(ChatList chatList, long offsetOrder, long offsetChatId, int limit) { this.chatList = chatList; @@ -17775,218 +44837,387 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = 1847129537; + public GetChats(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.offsetOrder = input.readLong(); + this.offsetChatId = input.readLong(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + output.writeLong(this.offsetOrder); + output.writeLong(this.offsetChatId); + output.writeInt(this.limit); + } } public static class GetConnectedWebsites extends Function { - - public GetConnectedWebsites() { - } - public static final int CONSTRUCTOR = -170536110; - @Override + public GetConnectedWebsites() {} + + + public GetConnectedWebsites(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetContacts extends Function { - - public GetContacts() { - } - public static final int CONSTRUCTOR = -1417722768; - @Override + public GetContacts() {} + + + public GetContacts(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetCountryCode extends Function { - - public GetCountryCode() { - } - public static final int CONSTRUCTOR = 1540593906; - @Override + public GetCountryCode() {} + + + public GetCountryCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetCreatedPublicChats extends Function { public PublicChatType type; - public GetCreatedPublicChats() { - } + public static final int CONSTRUCTOR = 710354415; + + public GetCreatedPublicChats() {} public GetCreatedPublicChats(PublicChatType type) { this.type = type; } - public static final int CONSTRUCTOR = 710354415; + public GetCreatedPublicChats(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PublicChatTypeHasUsername.CONSTRUCTOR: + this.type = new PublicChatTypeHasUsername(input); + break; + case PublicChatTypeIsLocationBased.CONSTRUCTOR: + this.type = new PublicChatTypeIsLocationBased(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class GetCurrentState extends Function { - - public GetCurrentState() { - } - public static final int CONSTRUCTOR = -1191417719; - @Override + public GetCurrentState() {} + + + public GetCurrentState(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetDatabaseStatistics extends Function { - - public GetDatabaseStatistics() { - } - public static final int CONSTRUCTOR = -1942760263; - @Override + public GetDatabaseStatistics() {} + + + public GetDatabaseStatistics(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetDeepLinkInfo extends Function { public String link; - public GetDeepLinkInfo() { - } + public static final int CONSTRUCTOR = 680673150; + + public GetDeepLinkInfo() {} public GetDeepLinkInfo(String link) { this.link = link; } - public static final int CONSTRUCTOR = 680673150; + public GetDeepLinkInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var linkTmp = new byte[input.readInt()]; + input.readFully(linkTmp); + this.link = new String(linkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.link == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var linkTmp = this.link.getBytes(StandardCharsets.UTF_8); + output.writeInt(linkTmp.length); + output.write(linkTmp); + } + } } public static class GetEmojiSuggestionsUrl extends Function { public String languageCode; - public GetEmojiSuggestionsUrl() { - } + public static final int CONSTRUCTOR = -1404101841; + + public GetEmojiSuggestionsUrl() {} public GetEmojiSuggestionsUrl(String languageCode) { this.languageCode = languageCode; } - public static final int CONSTRUCTOR = -1404101841; + public GetEmojiSuggestionsUrl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languageCodeTmp = new byte[input.readInt()]; + input.readFully(languageCodeTmp); + this.languageCode = new String(languageCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languageCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languageCodeTmp = this.languageCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(languageCodeTmp.length); + output.write(languageCodeTmp); + } + } } public static class GetFavoriteStickers extends Function { - - public GetFavoriteStickers() { - } - public static final int CONSTRUCTOR = -338964672; - @Override + public GetFavoriteStickers() {} + + + public GetFavoriteStickers(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetFile extends Function { public int fileId; - public GetFile() { - } + public static final int CONSTRUCTOR = 1553923406; + + public GetFile() {} public GetFile(int fileId) { this.fileId = fileId; } - public static final int CONSTRUCTOR = 1553923406; + public GetFile(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + } } public static class GetFileDownloadedPrefixSize extends Function { public int fileId; public int offset; - public GetFileDownloadedPrefixSize() { - } + public static final int CONSTRUCTOR = -1668864864; + + public GetFileDownloadedPrefixSize() {} public GetFileDownloadedPrefixSize(int fileId, int offset) { this.fileId = fileId; this.offset = offset; } - public static final int CONSTRUCTOR = -1668864864; + public GetFileDownloadedPrefixSize(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + this.offset = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + output.writeInt(this.offset); + } } public static class GetFileExtension extends Function { public String mimeType; - public GetFileExtension() { - } + public static final int CONSTRUCTOR = -106055372; + + public GetFileExtension() {} public GetFileExtension(String mimeType) { this.mimeType = mimeType; } - public static final int CONSTRUCTOR = -106055372; + public GetFileExtension(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var mimeTypeTmp = new byte[input.readInt()]; + input.readFully(mimeTypeTmp); + this.mimeType = new String(mimeTypeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.mimeType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var mimeTypeTmp = this.mimeType.getBytes(StandardCharsets.UTF_8); + output.writeInt(mimeTypeTmp.length); + output.write(mimeTypeTmp); + } + } } public static class GetFileMimeType extends Function { public String fileName; - public GetFileMimeType() { - } + public static final int CONSTRUCTOR = -2073879671; + + public GetFileMimeType() {} public GetFileMimeType(String fileName) { this.fileName = fileName; } - public static final int CONSTRUCTOR = -2073879671; + public GetFileMimeType(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var fileNameTmp = new byte[input.readInt()]; + input.readFully(fileNameTmp); + this.fileName = new String(fileNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.fileName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var fileNameTmp = this.fileName.getBytes(StandardCharsets.UTF_8); + output.writeInt(fileNameTmp.length); + output.write(fileNameTmp); + } + } } public static class GetGameHighScores extends Function { @@ -17994,8 +45225,9 @@ public class TdApi { public long messageId; public int userId; - public GetGameHighScores() { - } + public static final int CONSTRUCTOR = 1920923753; + + public GetGameHighScores() {} public GetGameHighScores(long chatId, long messageId, int userId) { this.chatId = chatId; @@ -18003,12 +45235,22 @@ public class TdApi { this.userId = userId; } - public static final int CONSTRUCTOR = 1920923753; + public GetGameHighScores(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.userId); + } } public static class GetGroupsInCommon extends Function { @@ -18016,8 +45258,9 @@ public class TdApi { public long offsetChatId; public int limit; - public GetGroupsInCommon() { - } + public static final int CONSTRUCTOR = -23238689; + + public GetGroupsInCommon() {} public GetGroupsInCommon(int userId, long offsetChatId, int limit) { this.userId = userId; @@ -18025,58 +45268,98 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = -23238689; + public GetGroupsInCommon(DataInputStream input) throws IOException { + this.userId = input.readInt(); + this.offsetChatId = input.readLong(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + output.writeLong(this.offsetChatId); + output.writeInt(this.limit); + } } public static class GetImportedContactCount extends Function { - - public GetImportedContactCount() { - } - public static final int CONSTRUCTOR = -656336346; - @Override + public GetImportedContactCount() {} + + + public GetImportedContactCount(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetInactiveSupergroupChats extends Function { - - public GetInactiveSupergroupChats() { - } - public static final int CONSTRUCTOR = -657720907; - @Override + public GetInactiveSupergroupChats() {} + + + public GetInactiveSupergroupChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetInlineGameHighScores extends Function { public String inlineMessageId; public int userId; - public GetInlineGameHighScores() { - } + public static final int CONSTRUCTOR = -1833445800; + + public GetInlineGameHighScores() {} public GetInlineGameHighScores(String inlineMessageId, int userId) { this.inlineMessageId = inlineMessageId; this.userId = userId; } - public static final int CONSTRUCTOR = -1833445800; + public GetInlineGameHighScores(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + output.writeInt(this.userId); + } } public static class GetInlineQueryResults extends Function { @@ -18086,8 +45369,9 @@ public class TdApi { public String query; public String offset; - public GetInlineQueryResults() { - } + public static final int CONSTRUCTOR = -1182511172; + + public GetInlineQueryResults() {} public GetInlineQueryResults(int botUserId, long chatId, Location userLocation, String query, String offset) { this.botUserId = botUserId; @@ -18097,97 +45381,226 @@ public class TdApi { this.offset = offset; } - public static final int CONSTRUCTOR = -1182511172; + public GetInlineQueryResults(DataInputStream input) throws IOException { + this.botUserId = input.readInt(); + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.userLocation = new Location(input); + } + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var offsetTmp = new byte[input.readInt()]; + input.readFully(offsetTmp); + this.offset = new String(offsetTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.botUserId); + output.writeLong(this.chatId); + if (this.userLocation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.userLocation.serialize(output); + } + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + if (this.offset == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var offsetTmp = this.offset.getBytes(StandardCharsets.UTF_8); + output.writeInt(offsetTmp.length); + output.write(offsetTmp); + } + } } public static class GetInstalledStickerSets extends Function { public boolean isMasks; - public GetInstalledStickerSets() { - } + public static final int CONSTRUCTOR = 1214523749; + + public GetInstalledStickerSets() {} public GetInstalledStickerSets(boolean isMasks) { this.isMasks = isMasks; } - public static final int CONSTRUCTOR = 1214523749; + public GetInstalledStickerSets(DataInputStream input) throws IOException { + this.isMasks = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isMasks); + } } public static class GetInviteText extends Function { - - public GetInviteText() { - } - public static final int CONSTRUCTOR = 794573512; - @Override + public GetInviteText() {} + + + public GetInviteText(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetJsonString extends Function { public JsonValue jsonValue; - public GetJsonString() { - } + public static final int CONSTRUCTOR = 663458849; + + public GetJsonString() {} public GetJsonString(JsonValue jsonValue) { this.jsonValue = jsonValue; } - public static final int CONSTRUCTOR = 663458849; + public GetJsonString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case JsonValueNull.CONSTRUCTOR: + this.jsonValue = new JsonValueNull(input); + break; + case JsonValueBoolean.CONSTRUCTOR: + this.jsonValue = new JsonValueBoolean(input); + break; + case JsonValueNumber.CONSTRUCTOR: + this.jsonValue = new JsonValueNumber(input); + break; + case JsonValueString.CONSTRUCTOR: + this.jsonValue = new JsonValueString(input); + break; + case JsonValueArray.CONSTRUCTOR: + this.jsonValue = new JsonValueArray(input); + break; + case JsonValueObject.CONSTRUCTOR: + this.jsonValue = new JsonValueObject(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.jsonValue == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.jsonValue.serialize(output); + } + } } public static class GetJsonValue extends Function { public String json; - public GetJsonValue() { - } + public static final int CONSTRUCTOR = -1829086715; + + public GetJsonValue() {} public GetJsonValue(String json) { this.json = json; } - public static final int CONSTRUCTOR = -1829086715; + public GetJsonValue(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var jsonTmp = new byte[input.readInt()]; + input.readFully(jsonTmp); + this.json = new String(jsonTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.json == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var jsonTmp = this.json.getBytes(StandardCharsets.UTF_8); + output.writeInt(jsonTmp.length); + output.write(jsonTmp); + } + } } public static class GetLanguagePackInfo extends Function { public String languagePackId; - public GetLanguagePackInfo() { - } + public static final int CONSTRUCTOR = 2077809320; + + public GetLanguagePackInfo() {} public GetLanguagePackInfo(String languagePackId) { this.languagePackId = languagePackId; } - public static final int CONSTRUCTOR = 2077809320; + public GetLanguagePackInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + } } public static class GetLanguagePackString extends Function { @@ -18196,8 +45609,9 @@ public class TdApi { public String languagePackId; public String key; - public GetLanguagePackString() { - } + public static final int CONSTRUCTOR = 150789747; + + public GetLanguagePackString() {} public GetLanguagePackString(String languagePackDatabasePath, String localizationTarget, String languagePackId, String key) { this.languagePackDatabasePath = languagePackDatabasePath; @@ -18206,107 +45620,233 @@ public class TdApi { this.key = key; } - public static final int CONSTRUCTOR = 150789747; + public GetLanguagePackString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackDatabasePathTmp = new byte[input.readInt()]; + input.readFully(languagePackDatabasePathTmp); + this.languagePackDatabasePath = new String(languagePackDatabasePathTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var localizationTargetTmp = new byte[input.readInt()]; + input.readFully(localizationTargetTmp); + this.localizationTarget = new String(localizationTargetTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var keyTmp = new byte[input.readInt()]; + input.readFully(keyTmp); + this.key = new String(keyTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackDatabasePath == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackDatabasePathTmp = this.languagePackDatabasePath.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackDatabasePathTmp.length); + output.write(languagePackDatabasePathTmp); + } + if (this.localizationTarget == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var localizationTargetTmp = this.localizationTarget.getBytes(StandardCharsets.UTF_8); + output.writeInt(localizationTargetTmp.length); + output.write(localizationTargetTmp); + } + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + if (this.key == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var keyTmp = this.key.getBytes(StandardCharsets.UTF_8); + output.writeInt(keyTmp.length); + output.write(keyTmp); + } + } } public static class GetLanguagePackStrings extends Function { public String languagePackId; public String[] keys; - public GetLanguagePackStrings() { - } + public static final int CONSTRUCTOR = 1246259088; + + public GetLanguagePackStrings() {} public GetLanguagePackStrings(String languagePackId, String[] keys) { this.languagePackId = languagePackId; this.keys = keys; } - public static final int CONSTRUCTOR = 1246259088; + public GetLanguagePackStrings(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + this.keys = new String[input.readInt()]; + for (int i = 0; i < this.keys.length; i++) { + var keysTmp = new byte[input.readInt()]; + input.readFully(keysTmp); + this.keys[i] = new String(keysTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + output.writeInt(this.keys.length); + for (int i = 0; i < this.keys.length; i++) { + var keysTmp = this.keys[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(keysTmp.length); + output.write(keysTmp); + } + } } public static class GetLocalizationTargetInfo extends Function { public boolean onlyLocal; - public GetLocalizationTargetInfo() { - } + public static final int CONSTRUCTOR = 1849499526; + + public GetLocalizationTargetInfo() {} public GetLocalizationTargetInfo(boolean onlyLocal) { this.onlyLocal = onlyLocal; } - public static final int CONSTRUCTOR = 1849499526; + public GetLocalizationTargetInfo(DataInputStream input) throws IOException { + this.onlyLocal = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.onlyLocal); + } } public static class GetLogStream extends Function { - - public GetLogStream() { - } - public static final int CONSTRUCTOR = 1167608667; - @Override + public GetLogStream() {} + + + public GetLogStream(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetLogTagVerbosityLevel extends Function { public String tag; - public GetLogTagVerbosityLevel() { - } + public static final int CONSTRUCTOR = 951004547; + + public GetLogTagVerbosityLevel() {} public GetLogTagVerbosityLevel(String tag) { this.tag = tag; } - public static final int CONSTRUCTOR = 951004547; + public GetLogTagVerbosityLevel(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tagTmp = new byte[input.readInt()]; + input.readFully(tagTmp); + this.tag = new String(tagTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.tag == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tagTmp = this.tag.getBytes(StandardCharsets.UTF_8); + output.writeInt(tagTmp.length); + output.write(tagTmp); + } + } } public static class GetLogTags extends Function { - - public GetLogTags() { - } - public static final int CONSTRUCTOR = -254449190; - @Override + public GetLogTags() {} + + + public GetLogTags(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetLogVerbosityLevel extends Function { - - public GetLogVerbosityLevel() { - } - public static final int CONSTRUCTOR = 594057956; - @Override + public GetLogVerbosityLevel() {} + + + public GetLogVerbosityLevel(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetLoginUrl extends Function { @@ -18315,8 +45855,9 @@ public class TdApi { public int buttonId; public boolean allowWriteAccess; - public GetLoginUrl() { - } + public static final int CONSTRUCTOR = 694973925; + + public GetLoginUrl() {} public GetLoginUrl(long chatId, long messageId, int buttonId, boolean allowWriteAccess) { this.chatId = chatId; @@ -18325,12 +45866,24 @@ public class TdApi { this.allowWriteAccess = allowWriteAccess; } - public static final int CONSTRUCTOR = 694973925; + public GetLoginUrl(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.buttonId = input.readInt(); + this.allowWriteAccess = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.buttonId); + output.writeBoolean(this.allowWriteAccess); + } } public static class GetLoginUrlInfo extends Function { @@ -18338,8 +45891,9 @@ public class TdApi { public long messageId; public int buttonId; - public GetLoginUrlInfo() { - } + public static final int CONSTRUCTOR = -980042966; + + public GetLoginUrlInfo() {} public GetLoginUrlInfo(long chatId, long messageId, int buttonId) { this.chatId = chatId; @@ -18347,12 +45901,22 @@ public class TdApi { this.buttonId = buttonId; } - public static final int CONSTRUCTOR = -980042966; + public GetLoginUrlInfo(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.buttonId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.buttonId); + } } public static class GetMapThumbnailFile extends Function { @@ -18363,8 +45927,9 @@ public class TdApi { public int scale; public long chatId; - public GetMapThumbnailFile() { - } + public static final int CONSTRUCTOR = -152660070; + + public GetMapThumbnailFile() {} public GetMapThumbnailFile(Location location, int zoom, int width, int height, int scale, long chatId) { this.location = location; @@ -18375,177 +45940,310 @@ public class TdApi { this.chatId = chatId; } - public static final int CONSTRUCTOR = -152660070; + public GetMapThumbnailFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + this.zoom = input.readInt(); + this.width = input.readInt(); + this.height = input.readInt(); + this.scale = input.readInt(); + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + output.writeInt(this.zoom); + output.writeInt(this.width); + output.writeInt(this.height); + output.writeInt(this.scale); + output.writeLong(this.chatId); + } } public static class GetMarkdownText extends Function { public FormattedText text; - public GetMarkdownText() { - } + public static final int CONSTRUCTOR = 164524584; + + public GetMarkdownText() {} public GetMarkdownText(FormattedText text) { this.text = text; } - public static final int CONSTRUCTOR = 164524584; + public GetMarkdownText(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class GetMe extends Function { - - public GetMe() { - } - public static final int CONSTRUCTOR = -191516033; - @Override + public GetMe() {} + + + public GetMe(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetMessage extends Function { public long chatId; public long messageId; - public GetMessage() { - } + public static final int CONSTRUCTOR = -1821196160; + + public GetMessage() {} public GetMessage(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -1821196160; + public GetMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class GetMessageLink extends Function { public long chatId; public long messageId; - public GetMessageLink() { - } + public static final int CONSTRUCTOR = 1362732326; + + public GetMessageLink() {} public GetMessageLink(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = 1362732326; + public GetMessageLink(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class GetMessageLinkInfo extends Function { public String url; - public GetMessageLinkInfo() { - } + public static final int CONSTRUCTOR = -700533672; + + public GetMessageLinkInfo() {} public GetMessageLinkInfo(String url) { this.url = url; } - public static final int CONSTRUCTOR = -700533672; + public GetMessageLinkInfo(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + } } public static class GetMessageLocally extends Function { public long chatId; public long messageId; - public GetMessageLocally() { - } + public static final int CONSTRUCTOR = -603575444; + + public GetMessageLocally() {} public GetMessageLocally(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -603575444; + public GetMessageLocally(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class GetMessages extends Function { public long chatId; public long[] messageIds; - public GetMessages() { - } + public static final int CONSTRUCTOR = 425299338; + + public GetMessages() {} public GetMessages(long chatId, long[] messageIds) { this.chatId = chatId; this.messageIds = messageIds; } - public static final int CONSTRUCTOR = 425299338; + public GetMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + } } public static class GetNetworkStatistics extends Function { public boolean onlyCurrent; - public GetNetworkStatistics() { - } + public static final int CONSTRUCTOR = -986228706; + + public GetNetworkStatistics() {} public GetNetworkStatistics(boolean onlyCurrent) { this.onlyCurrent = onlyCurrent; } - public static final int CONSTRUCTOR = -986228706; + public GetNetworkStatistics(DataInputStream input) throws IOException { + this.onlyCurrent = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.onlyCurrent); + } } public static class GetOption extends Function { public String name; - public GetOption() { - } + public static final int CONSTRUCTOR = -1572495746; + + public GetOption() {} public GetOption(String name) { this.name = name; } - public static final int CONSTRUCTOR = -1572495746; + public GetOption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + } } public static class GetPassportAuthorizationForm extends Function { @@ -18554,8 +46252,9 @@ public class TdApi { public String publicKey; public String nonce; - public GetPassportAuthorizationForm() { - } + public static final int CONSTRUCTOR = -1468394095; + + public GetPassportAuthorizationForm() {} public GetPassportAuthorizationForm(int botUserId, String scope, String publicKey, String nonce) { this.botUserId = botUserId; @@ -18564,105 +46263,262 @@ public class TdApi { this.nonce = nonce; } - public static final int CONSTRUCTOR = -1468394095; + public GetPassportAuthorizationForm(DataInputStream input) throws IOException { + this.botUserId = input.readInt(); + if (input.readBoolean()) { + var scopeTmp = new byte[input.readInt()]; + input.readFully(scopeTmp); + this.scope = new String(scopeTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var publicKeyTmp = new byte[input.readInt()]; + input.readFully(publicKeyTmp); + this.publicKey = new String(publicKeyTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var nonceTmp = new byte[input.readInt()]; + input.readFully(nonceTmp); + this.nonce = new String(nonceTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.botUserId); + if (this.scope == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var scopeTmp = this.scope.getBytes(StandardCharsets.UTF_8); + output.writeInt(scopeTmp.length); + output.write(scopeTmp); + } + if (this.publicKey == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var publicKeyTmp = this.publicKey.getBytes(StandardCharsets.UTF_8); + output.writeInt(publicKeyTmp.length); + output.write(publicKeyTmp); + } + if (this.nonce == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nonceTmp = this.nonce.getBytes(StandardCharsets.UTF_8); + output.writeInt(nonceTmp.length); + output.write(nonceTmp); + } + } } public static class GetPassportAuthorizationFormAvailableElements extends Function { public int autorizationFormId; public String password; - public GetPassportAuthorizationFormAvailableElements() { - } + public static final int CONSTRUCTOR = 1738134754; + + public GetPassportAuthorizationFormAvailableElements() {} public GetPassportAuthorizationFormAvailableElements(int autorizationFormId, String password) { this.autorizationFormId = autorizationFormId; this.password = password; } - public static final int CONSTRUCTOR = 1738134754; + public GetPassportAuthorizationFormAvailableElements(DataInputStream input) throws IOException { + this.autorizationFormId = input.readInt(); + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.autorizationFormId); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class GetPassportElement extends Function { public PassportElementType type; public String password; - public GetPassportElement() { - } + public static final int CONSTRUCTOR = -1882398342; + + public GetPassportElement() {} public GetPassportElement(PassportElementType type, String password) { this.type = type; this.password = password; } - public static final int CONSTRUCTOR = -1882398342; + public GetPassportElement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.type = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.type = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.type = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.type = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.type = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.type = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.type = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.type = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.type = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.type = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.type = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.type = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.type = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class GetPasswordState extends Function { - - public GetPasswordState() { - } - public static final int CONSTRUCTOR = -174752904; - @Override + public GetPasswordState() {} + + + public GetPasswordState(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetPaymentForm extends Function { public long chatId; public long messageId; - public GetPaymentForm() { - } + public static final int CONSTRUCTOR = -2146950882; + + public GetPaymentForm() {} public GetPaymentForm(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -2146950882; + public GetPaymentForm(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class GetPaymentReceipt extends Function { public long chatId; public long messageId; - public GetPaymentReceipt() { - } + public static final int CONSTRUCTOR = 1013758294; + + public GetPaymentReceipt() {} public GetPaymentReceipt(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = 1013758294; + public GetPaymentReceipt(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class GetPollVoters extends Function { @@ -18672,8 +46528,9 @@ public class TdApi { public int offset; public int limit; - public GetPollVoters() { - } + public static final int CONSTRUCTOR = 2075288734; + + public GetPollVoters() {} public GetPollVoters(long chatId, long messageId, int optionId, int offset, int limit) { this.chatId = chatId; @@ -18683,61 +46540,105 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = 2075288734; + public GetPollVoters(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.optionId = input.readInt(); + this.offset = input.readInt(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.optionId); + output.writeInt(this.offset); + output.writeInt(this.limit); + } } public static class GetPreferredCountryLanguage extends Function { public String countryCode; - public GetPreferredCountryLanguage() { - } + public static final int CONSTRUCTOR = -933049386; + + public GetPreferredCountryLanguage() {} public GetPreferredCountryLanguage(String countryCode) { this.countryCode = countryCode; } - public static final int CONSTRUCTOR = -933049386; + public GetPreferredCountryLanguage(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var countryCodeTmp = new byte[input.readInt()]; + input.readFully(countryCodeTmp); + this.countryCode = new String(countryCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.countryCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var countryCodeTmp = this.countryCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(countryCodeTmp.length); + output.write(countryCodeTmp); + } + } } public static class GetProxies extends Function { - - public GetProxies() { - } - public static final int CONSTRUCTOR = -95026381; - @Override + public GetProxies() {} + + + public GetProxies(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetProxyLink extends Function { public int proxyId; - public GetProxyLink() { - } + public static final int CONSTRUCTOR = -1285597664; + + public GetProxyLink() {} public GetProxyLink(int proxyId) { this.proxyId = proxyId; } - public static final int CONSTRUCTOR = -1285597664; + public GetProxyLink(DataInputStream input) throws IOException { + this.proxyId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.proxyId); + } } public static class GetPublicMessageLink extends Function { @@ -18745,8 +46646,9 @@ public class TdApi { public long messageId; public boolean forAlbum; - public GetPublicMessageLink() { - } + public static final int CONSTRUCTOR = -374642839; + + public GetPublicMessageLink() {} public GetPublicMessageLink(long chatId, long messageId, boolean forAlbum) { this.chatId = chatId; @@ -18754,335 +46656,628 @@ public class TdApi { this.forAlbum = forAlbum; } - public static final int CONSTRUCTOR = -374642839; + public GetPublicMessageLink(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.forAlbum = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeBoolean(this.forAlbum); + } } public static class GetPushReceiverId extends Function { public String payload; - public GetPushReceiverId() { - } + public static final int CONSTRUCTOR = -286505294; + + public GetPushReceiverId() {} public GetPushReceiverId(String payload) { this.payload = payload; } - public static final int CONSTRUCTOR = -286505294; + public GetPushReceiverId(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var payloadTmp = new byte[input.readInt()]; + input.readFully(payloadTmp); + this.payload = new String(payloadTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.payload == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var payloadTmp = this.payload.getBytes(StandardCharsets.UTF_8); + output.writeInt(payloadTmp.length); + output.write(payloadTmp); + } + } } public static class GetRecentInlineBots extends Function { - - public GetRecentInlineBots() { - } - public static final int CONSTRUCTOR = 1437823548; - @Override + public GetRecentInlineBots() {} + + + public GetRecentInlineBots(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetRecentStickers extends Function { public boolean isAttached; - public GetRecentStickers() { - } + public static final int CONSTRUCTOR = -579622241; + + public GetRecentStickers() {} public GetRecentStickers(boolean isAttached) { this.isAttached = isAttached; } - public static final int CONSTRUCTOR = -579622241; + public GetRecentStickers(DataInputStream input) throws IOException { + this.isAttached = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAttached); + } } public static class GetRecentlyVisitedTMeUrls extends Function { public String referrer; - public GetRecentlyVisitedTMeUrls() { - } + public static final int CONSTRUCTOR = 806754961; + + public GetRecentlyVisitedTMeUrls() {} public GetRecentlyVisitedTMeUrls(String referrer) { this.referrer = referrer; } - public static final int CONSTRUCTOR = 806754961; + public GetRecentlyVisitedTMeUrls(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var referrerTmp = new byte[input.readInt()]; + input.readFully(referrerTmp); + this.referrer = new String(referrerTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.referrer == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var referrerTmp = this.referrer.getBytes(StandardCharsets.UTF_8); + output.writeInt(referrerTmp.length); + output.write(referrerTmp); + } + } } public static class GetRecoveryEmailAddress extends Function { public String password; - public GetRecoveryEmailAddress() { - } + public static final int CONSTRUCTOR = -1594770947; + + public GetRecoveryEmailAddress() {} public GetRecoveryEmailAddress(String password) { this.password = password; } - public static final int CONSTRUCTOR = -1594770947; + public GetRecoveryEmailAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class GetRemoteFile extends Function { public String remoteFileId; public FileType fileType; - public GetRemoteFile() { - } + public static final int CONSTRUCTOR = 2137204530; + + public GetRemoteFile() {} public GetRemoteFile(String remoteFileId, FileType fileType) { this.remoteFileId = remoteFileId; this.fileType = fileType; } - public static final int CONSTRUCTOR = 2137204530; + public GetRemoteFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var remoteFileIdTmp = new byte[input.readInt()]; + input.readFully(remoteFileIdTmp); + this.remoteFileId = new String(remoteFileIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case FileTypeNone.CONSTRUCTOR: + this.fileType = new FileTypeNone(input); + break; + case FileTypeAnimation.CONSTRUCTOR: + this.fileType = new FileTypeAnimation(input); + break; + case FileTypeAudio.CONSTRUCTOR: + this.fileType = new FileTypeAudio(input); + break; + case FileTypeDocument.CONSTRUCTOR: + this.fileType = new FileTypeDocument(input); + break; + case FileTypePhoto.CONSTRUCTOR: + this.fileType = new FileTypePhoto(input); + break; + case FileTypeProfilePhoto.CONSTRUCTOR: + this.fileType = new FileTypeProfilePhoto(input); + break; + case FileTypeSecret.CONSTRUCTOR: + this.fileType = new FileTypeSecret(input); + break; + case FileTypeSecretThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeSecretThumbnail(input); + break; + case FileTypeSecure.CONSTRUCTOR: + this.fileType = new FileTypeSecure(input); + break; + case FileTypeSticker.CONSTRUCTOR: + this.fileType = new FileTypeSticker(input); + break; + case FileTypeThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeThumbnail(input); + break; + case FileTypeUnknown.CONSTRUCTOR: + this.fileType = new FileTypeUnknown(input); + break; + case FileTypeVideo.CONSTRUCTOR: + this.fileType = new FileTypeVideo(input); + break; + case FileTypeVideoNote.CONSTRUCTOR: + this.fileType = new FileTypeVideoNote(input); + break; + case FileTypeVoiceNote.CONSTRUCTOR: + this.fileType = new FileTypeVoiceNote(input); + break; + case FileTypeWallpaper.CONSTRUCTOR: + this.fileType = new FileTypeWallpaper(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.remoteFileId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var remoteFileIdTmp = this.remoteFileId.getBytes(StandardCharsets.UTF_8); + output.writeInt(remoteFileIdTmp.length); + output.write(remoteFileIdTmp); + } + if (this.fileType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.fileType.serialize(output); + } + } } public static class GetRepliedMessage extends Function { public long chatId; public long messageId; - public GetRepliedMessage() { - } + public static final int CONSTRUCTOR = -641918531; + + public GetRepliedMessage() {} public GetRepliedMessage(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -641918531; + public GetRepliedMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class GetSavedAnimations extends Function { - - public GetSavedAnimations() { - } - public static final int CONSTRUCTOR = 7051032; - @Override + public GetSavedAnimations() {} + + + public GetSavedAnimations(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetSavedOrderInfo extends Function { - - public GetSavedOrderInfo() { - } - public static final int CONSTRUCTOR = -1152016675; - @Override + public GetSavedOrderInfo() {} + + + public GetSavedOrderInfo(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetScopeNotificationSettings extends Function { public NotificationSettingsScope scope; - public GetScopeNotificationSettings() { - } + public static final int CONSTRUCTOR = -995613361; + + public GetScopeNotificationSettings() {} public GetScopeNotificationSettings(NotificationSettingsScope scope) { this.scope = scope; } - public static final int CONSTRUCTOR = -995613361; + public GetScopeNotificationSettings(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationSettingsScopePrivateChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopePrivateChats(input); + break; + case NotificationSettingsScopeGroupChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeGroupChats(input); + break; + case NotificationSettingsScopeChannelChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeChannelChats(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.scope == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.scope.serialize(output); + } + } } public static class GetSecretChat extends Function { public int secretChatId; - public GetSecretChat() { - } + public static final int CONSTRUCTOR = 40599169; + + public GetSecretChat() {} public GetSecretChat(int secretChatId) { this.secretChatId = secretChatId; } - public static final int CONSTRUCTOR = 40599169; + public GetSecretChat(DataInputStream input) throws IOException { + this.secretChatId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.secretChatId); + } } public static class GetStickerEmojis extends Function { public InputFile sticker; - public GetStickerEmojis() { - } + public static final int CONSTRUCTOR = -1895508665; + + public GetStickerEmojis() {} public GetStickerEmojis(InputFile sticker) { this.sticker = sticker; } - public static final int CONSTRUCTOR = -1895508665; + public GetStickerEmojis(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class GetStickerSet extends Function { public long setId; - public GetStickerSet() { - } + public static final int CONSTRUCTOR = 1052318659; + + public GetStickerSet() {} public GetStickerSet(long setId) { this.setId = setId; } - public static final int CONSTRUCTOR = 1052318659; + public GetStickerSet(DataInputStream input) throws IOException { + this.setId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.setId); + } } public static class GetStickers extends Function { public String emoji; public int limit; - public GetStickers() { - } + public static final int CONSTRUCTOR = -1594919556; + + public GetStickers() {} public GetStickers(String emoji, int limit) { this.emoji = emoji; this.limit = limit; } - public static final int CONSTRUCTOR = -1594919556; + public GetStickers(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emojiTmp = new byte[input.readInt()]; + input.readFully(emojiTmp); + this.emoji = new String(emojiTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emoji == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojiTmp = this.emoji.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojiTmp.length); + output.write(emojiTmp); + } + output.writeInt(this.limit); + } } public static class GetStorageStatistics extends Function { public int chatLimit; - public GetStorageStatistics() { - } + public static final int CONSTRUCTOR = -853193929; + + public GetStorageStatistics() {} public GetStorageStatistics(int chatLimit) { this.chatLimit = chatLimit; } - public static final int CONSTRUCTOR = -853193929; + public GetStorageStatistics(DataInputStream input) throws IOException { + this.chatLimit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.chatLimit); + } } public static class GetStorageStatisticsFast extends Function { - - public GetStorageStatisticsFast() { - } - public static final int CONSTRUCTOR = 61368066; - @Override + public GetStorageStatisticsFast() {} + + + public GetStorageStatisticsFast(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetSuitableDiscussionChats extends Function { - - public GetSuitableDiscussionChats() { - } - public static final int CONSTRUCTOR = 49044982; - @Override + public GetSuitableDiscussionChats() {} + + + public GetSuitableDiscussionChats(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetSupergroup extends Function { public int supergroupId; - public GetSupergroup() { - } + public static final int CONSTRUCTOR = -2063063706; + + public GetSupergroup() {} public GetSupergroup(int supergroupId) { this.supergroupId = supergroupId; } - public static final int CONSTRUCTOR = -2063063706; + public GetSupergroup(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + } } public static class GetSupergroupFullInfo extends Function { public int supergroupId; - public GetSupergroupFullInfo() { - } + public static final int CONSTRUCTOR = -1150331262; + + public GetSupergroupFullInfo() {} public GetSupergroupFullInfo(int supergroupId) { this.supergroupId = supergroupId; } - public static final int CONSTRUCTOR = -1150331262; + public GetSupergroupFullInfo(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + } } public static class GetSupergroupMembers extends Function { @@ -19091,8 +47286,9 @@ public class TdApi { public int offset; public int limit; - public GetSupergroupMembers() { - } + public static final int CONSTRUCTOR = 1427643098; + + public GetSupergroupMembers() {} public GetSupergroupMembers(int supergroupId, SupergroupMembersFilter filter, int offset, int limit) { this.supergroupId = supergroupId; @@ -19101,150 +47297,325 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = 1427643098; + public GetSupergroupMembers(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case SupergroupMembersFilterRecent.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterRecent(input); + break; + case SupergroupMembersFilterContacts.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterContacts(input); + break; + case SupergroupMembersFilterAdministrators.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterAdministrators(input); + break; + case SupergroupMembersFilterSearch.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterSearch(input); + break; + case SupergroupMembersFilterRestricted.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterRestricted(input); + break; + case SupergroupMembersFilterBanned.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterBanned(input); + break; + case SupergroupMembersFilterBots.CONSTRUCTOR: + this.filter = new SupergroupMembersFilterBots(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.offset = input.readInt(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + if (this.filter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.filter.serialize(output); + } + output.writeInt(this.offset); + output.writeInt(this.limit); + } } public static class GetSupportUser extends Function { - - public GetSupportUser() { - } - public static final int CONSTRUCTOR = -1733497700; - @Override + public GetSupportUser() {} + + + public GetSupportUser(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetTemporaryPasswordState extends Function { - - public GetTemporaryPasswordState() { - } - public static final int CONSTRUCTOR = -12670830; - @Override + public GetTemporaryPasswordState() {} + + + public GetTemporaryPasswordState(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class GetTextEntities extends Function { public String text; - public GetTextEntities() { - } + public static final int CONSTRUCTOR = -341490693; + + public GetTextEntities() {} public GetTextEntities(String text) { this.text = text; } - public static final int CONSTRUCTOR = -341490693; + public GetTextEntities(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + } } public static class GetTopChats extends Function { public TopChatCategory category; public int limit; - public GetTopChats() { - } + public static final int CONSTRUCTOR = -388410847; + + public GetTopChats() {} public GetTopChats(TopChatCategory category, int limit) { this.category = category; this.limit = limit; } - public static final int CONSTRUCTOR = -388410847; + public GetTopChats(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case TopChatCategoryUsers.CONSTRUCTOR: + this.category = new TopChatCategoryUsers(input); + break; + case TopChatCategoryBots.CONSTRUCTOR: + this.category = new TopChatCategoryBots(input); + break; + case TopChatCategoryGroups.CONSTRUCTOR: + this.category = new TopChatCategoryGroups(input); + break; + case TopChatCategoryChannels.CONSTRUCTOR: + this.category = new TopChatCategoryChannels(input); + break; + case TopChatCategoryInlineBots.CONSTRUCTOR: + this.category = new TopChatCategoryInlineBots(input); + break; + case TopChatCategoryCalls.CONSTRUCTOR: + this.category = new TopChatCategoryCalls(input); + break; + case TopChatCategoryForwardChats.CONSTRUCTOR: + this.category = new TopChatCategoryForwardChats(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.category == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.category.serialize(output); + } + output.writeInt(this.limit); + } } public static class GetTrendingStickerSets extends Function { public int offset; public int limit; - public GetTrendingStickerSets() { - } + public static final int CONSTRUCTOR = -1494581948; + + public GetTrendingStickerSets() {} public GetTrendingStickerSets(int offset, int limit) { this.offset = offset; this.limit = limit; } - public static final int CONSTRUCTOR = -1494581948; + public GetTrendingStickerSets(DataInputStream input) throws IOException { + this.offset = input.readInt(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.offset); + output.writeInt(this.limit); + } } public static class GetUser extends Function { public int userId; - public GetUser() { - } + public static final int CONSTRUCTOR = -47586017; + + public GetUser() {} public GetUser(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -47586017; + public GetUser(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class GetUserFullInfo extends Function { public int userId; - public GetUserFullInfo() { - } + public static final int CONSTRUCTOR = -655443263; + + public GetUserFullInfo() {} public GetUserFullInfo(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -655443263; + public GetUserFullInfo(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class GetUserPrivacySettingRules extends Function { public UserPrivacySetting setting; - public GetUserPrivacySettingRules() { - } + public static final int CONSTRUCTOR = -2077223311; + + public GetUserPrivacySettingRules() {} public GetUserPrivacySettingRules(UserPrivacySetting setting) { this.setting = setting; } - public static final int CONSTRUCTOR = -2077223311; + public GetUserPrivacySettingRules(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case UserPrivacySettingShowStatus.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowStatus(input); + break; + case UserPrivacySettingShowProfilePhoto.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowProfilePhoto(input); + break; + case UserPrivacySettingShowLinkInForwardedMessages.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowLinkInForwardedMessages(input); + break; + case UserPrivacySettingShowPhoneNumber.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowPhoneNumber(input); + break; + case UserPrivacySettingAllowChatInvites.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowChatInvites(input); + break; + case UserPrivacySettingAllowCalls.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowCalls(input); + break; + case UserPrivacySettingAllowPeerToPeerCalls.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowPeerToPeerCalls(input); + break; + case UserPrivacySettingAllowFindingByPhoneNumber.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowFindingByPhoneNumber(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.setting == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.setting.serialize(output); + } + } } public static class GetUserProfilePhotos extends Function { @@ -19252,8 +47623,9 @@ public class TdApi { public int offset; public int limit; - public GetUserProfilePhotos() { - } + public static final int CONSTRUCTOR = -2062927433; + + public GetUserProfilePhotos() {} public GetUserProfilePhotos(int userId, int offset, int limit) { this.userId = userId; @@ -19261,173 +47633,289 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = -2062927433; + public GetUserProfilePhotos(DataInputStream input) throws IOException { + this.userId = input.readInt(); + this.offset = input.readInt(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + output.writeInt(this.offset); + output.writeInt(this.limit); + } } public static class GetWebPageInstantView extends Function { public String url; public boolean forceFull; - public GetWebPageInstantView() { - } + public static final int CONSTRUCTOR = -1962649975; + + public GetWebPageInstantView() {} public GetWebPageInstantView(String url, boolean forceFull) { this.url = url; this.forceFull = forceFull; } - public static final int CONSTRUCTOR = -1962649975; + public GetWebPageInstantView(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var urlTmp = new byte[input.readInt()]; + input.readFully(urlTmp); + this.url = new String(urlTmp, StandardCharsets.UTF_8); + } + this.forceFull = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.url == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var urlTmp = this.url.getBytes(StandardCharsets.UTF_8); + output.writeInt(urlTmp.length); + output.write(urlTmp); + } + output.writeBoolean(this.forceFull); + } } public static class GetWebPagePreview extends Function { public FormattedText text; - public GetWebPagePreview() { - } + public static final int CONSTRUCTOR = 573441580; + + public GetWebPagePreview() {} public GetWebPagePreview(FormattedText text) { this.text = text; } - public static final int CONSTRUCTOR = 573441580; + public GetWebPagePreview(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class ImportContacts extends Function { public Contact[] contacts; - public ImportContacts() { - } + public static final int CONSTRUCTOR = -215132767; + + public ImportContacts() {} public ImportContacts(Contact[] contacts) { this.contacts = contacts; } - public static final int CONSTRUCTOR = -215132767; + public ImportContacts(DataInputStream input) throws IOException { + this.contacts = new Contact[input.readInt()]; + for (int i = 0; i < this.contacts.length; i++) { + if (Contact.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.contacts[i] = new Contact(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.contacts.length); + for (int i = 0; i < this.contacts.length; i++) { + this.contacts[i].serialize(output); + } + } } public static class JoinChat extends Function { public long chatId; - public JoinChat() { - } + public static final int CONSTRUCTOR = 326769313; + + public JoinChat() {} public JoinChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 326769313; + public JoinChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class JoinChatByInviteLink extends Function { public String inviteLink; - public JoinChatByInviteLink() { - } + public static final int CONSTRUCTOR = -1049973882; + + public JoinChatByInviteLink() {} public JoinChatByInviteLink(String inviteLink) { this.inviteLink = inviteLink; } - public static final int CONSTRUCTOR = -1049973882; + public JoinChatByInviteLink(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inviteLinkTmp = new byte[input.readInt()]; + input.readFully(inviteLinkTmp); + this.inviteLink = new String(inviteLinkTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inviteLink == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inviteLinkTmp = this.inviteLink.getBytes(StandardCharsets.UTF_8); + output.writeInt(inviteLinkTmp.length); + output.write(inviteLinkTmp); + } + } } public static class LeaveChat extends Function { public long chatId; - public LeaveChat() { - } + public static final int CONSTRUCTOR = -1825080735; + + public LeaveChat() {} public LeaveChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = -1825080735; + public LeaveChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class LogOut extends Function { - - public LogOut() { - } - public static final int CONSTRUCTOR = -1581923301; - @Override + public LogOut() {} + + + public LogOut(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class OpenChat extends Function { public long chatId; - public OpenChat() { - } + public static final int CONSTRUCTOR = -323371509; + + public OpenChat() {} public OpenChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = -323371509; + public OpenChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class OpenMessageContent extends Function { public long chatId; public long messageId; - public OpenMessageContent() { - } + public static final int CONSTRUCTOR = -739088005; + + public OpenMessageContent() {} public OpenMessageContent(long chatId, long messageId) { this.chatId = chatId; this.messageId = messageId; } - public static final int CONSTRUCTOR = -739088005; + public OpenMessageContent(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + } } public static class OptimizeStorage extends Function { @@ -19441,8 +47929,9 @@ public class TdApi { public boolean returnDeletedFileStatistics; public int chatLimit; - public OptimizeStorage() { - } + public static final int CONSTRUCTOR = 853186759; + + public OptimizeStorage() {} public OptimizeStorage(long size, int ttl, int count, int immunityDelay, FileType[] fileTypes, long[] chatIds, long[] excludeChatIds, boolean returnDeletedFileStatistics, int chatLimit) { this.size = size; @@ -19456,50 +47945,194 @@ public class TdApi { this.chatLimit = chatLimit; } - public static final int CONSTRUCTOR = 853186759; + public OptimizeStorage(DataInputStream input) throws IOException { + this.size = input.readLong(); + this.ttl = input.readInt(); + this.count = input.readInt(); + this.immunityDelay = input.readInt(); + this.fileTypes = new FileType[input.readInt()]; + for (int i = 0; i < this.fileTypes.length; i++) { + switch(input.readInt()) { + case FileTypeNone.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeNone(input); + break; + case FileTypeAnimation.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeAnimation(input); + break; + case FileTypeAudio.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeAudio(input); + break; + case FileTypeDocument.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeDocument(input); + break; + case FileTypePhoto.CONSTRUCTOR: + this.fileTypes[i] = new FileTypePhoto(input); + break; + case FileTypeProfilePhoto.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeProfilePhoto(input); + break; + case FileTypeSecret.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeSecret(input); + break; + case FileTypeSecretThumbnail.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeSecretThumbnail(input); + break; + case FileTypeSecure.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeSecure(input); + break; + case FileTypeSticker.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeSticker(input); + break; + case FileTypeThumbnail.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeThumbnail(input); + break; + case FileTypeUnknown.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeUnknown(input); + break; + case FileTypeVideo.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeVideo(input); + break; + case FileTypeVideoNote.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeVideoNote(input); + break; + case FileTypeVoiceNote.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeVoiceNote(input); + break; + case FileTypeWallpaper.CONSTRUCTOR: + this.fileTypes[i] = new FileTypeWallpaper(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.chatIds = new long[input.readInt()]; + for (int i = 0; i < this.chatIds.length; i++) { + this.chatIds[i] = input.readLong(); + } + this.excludeChatIds = new long[input.readInt()]; + for (int i = 0; i < this.excludeChatIds.length; i++) { + this.excludeChatIds[i] = input.readLong(); + } + this.returnDeletedFileStatistics = input.readBoolean(); + this.chatLimit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.size); + output.writeInt(this.ttl); + output.writeInt(this.count); + output.writeInt(this.immunityDelay); + output.writeInt(this.fileTypes.length); + for (int i = 0; i < this.fileTypes.length; i++) { + this.fileTypes[i].serialize(output); + } + output.writeInt(this.chatIds.length); + for (int i = 0; i < this.chatIds.length; i++) { + output.writeLong(this.chatIds[i]); + } + output.writeInt(this.excludeChatIds.length); + for (int i = 0; i < this.excludeChatIds.length; i++) { + output.writeLong(this.excludeChatIds[i]); + } + output.writeBoolean(this.returnDeletedFileStatistics); + output.writeInt(this.chatLimit); + } } public static class ParseMarkdown extends Function { public FormattedText text; - public ParseMarkdown() { - } + public static final int CONSTRUCTOR = 756366063; + + public ParseMarkdown() {} public ParseMarkdown(FormattedText text) { this.text = text; } - public static final int CONSTRUCTOR = 756366063; + public ParseMarkdown(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (FormattedText.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.text = new FormattedText(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.text.serialize(output); + } + } } public static class ParseTextEntities extends Function { public String text; public TextParseMode parseMode; - public ParseTextEntities() { - } + public static final int CONSTRUCTOR = -1709194593; + + public ParseTextEntities() {} public ParseTextEntities(String text, TextParseMode parseMode) { this.text = text; this.parseMode = parseMode; } - public static final int CONSTRUCTOR = -1709194593; + public ParseTextEntities(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case TextParseModeMarkdown.CONSTRUCTOR: + this.parseMode = new TextParseModeMarkdown(input); + break; + case TextParseModeHTML.CONSTRUCTOR: + this.parseMode = new TextParseModeHTML(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + if (this.parseMode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.parseMode.serialize(output); + } + } } public static class PinChatMessage extends Function { @@ -19507,8 +48140,9 @@ public class TdApi { public long messageId; public boolean disableNotification; - public PinChatMessage() { - } + public static final int CONSTRUCTOR = -554712351; + + public PinChatMessage() {} public PinChatMessage(long chatId, long messageId, boolean disableNotification) { this.chatId = chatId; @@ -19516,66 +48150,108 @@ public class TdApi { this.disableNotification = disableNotification; } - public static final int CONSTRUCTOR = -554712351; + public PinChatMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.disableNotification = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeBoolean(this.disableNotification); + } } public static class PingProxy extends Function { public int proxyId; - public PingProxy() { - } + public static final int CONSTRUCTOR = -979681103; + + public PingProxy() {} public PingProxy(int proxyId) { this.proxyId = proxyId; } - public static final int CONSTRUCTOR = -979681103; + public PingProxy(DataInputStream input) throws IOException { + this.proxyId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.proxyId); + } } public static class ProcessPushNotification extends Function { public String payload; - public ProcessPushNotification() { - } + public static final int CONSTRUCTOR = 786679952; + + public ProcessPushNotification() {} public ProcessPushNotification(String payload) { this.payload = payload; } - public static final int CONSTRUCTOR = 786679952; + public ProcessPushNotification(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var payloadTmp = new byte[input.readInt()]; + input.readFully(payloadTmp); + this.payload = new String(payloadTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.payload == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var payloadTmp = this.payload.getBytes(StandardCharsets.UTF_8); + output.writeInt(payloadTmp.length); + output.write(payloadTmp); + } + } } public static class ReadAllChatMentions extends Function { public long chatId; - public ReadAllChatMentions() { - } + public static final int CONSTRUCTOR = 1357558453; + + public ReadAllChatMentions() {} public ReadAllChatMentions(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 1357558453; + public ReadAllChatMentions(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class ReadFilePart extends Function { @@ -19583,8 +48259,9 @@ public class TdApi { public int offset; public int count; - public ReadFilePart() { - } + public static final int CONSTRUCTOR = -407749314; + + public ReadFilePart() {} public ReadFilePart(int fileId, int offset, int count) { this.fileId = fileId; @@ -19592,350 +48269,735 @@ public class TdApi { this.count = count; } - public static final int CONSTRUCTOR = -407749314; + public ReadFilePart(DataInputStream input) throws IOException { + this.fileId = input.readInt(); + this.offset = input.readInt(); + this.count = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.fileId); + output.writeInt(this.offset); + output.writeInt(this.count); + } } public static class RecoverAuthenticationPassword extends Function { public String recoveryCode; - public RecoverAuthenticationPassword() { - } + public static final int CONSTRUCTOR = 787436412; + + public RecoverAuthenticationPassword() {} public RecoverAuthenticationPassword(String recoveryCode) { this.recoveryCode = recoveryCode; } - public static final int CONSTRUCTOR = 787436412; + public RecoverAuthenticationPassword(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var recoveryCodeTmp = new byte[input.readInt()]; + input.readFully(recoveryCodeTmp); + this.recoveryCode = new String(recoveryCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.recoveryCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var recoveryCodeTmp = this.recoveryCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(recoveryCodeTmp.length); + output.write(recoveryCodeTmp); + } + } } public static class RecoverPassword extends Function { public String recoveryCode; - public RecoverPassword() { - } + public static final int CONSTRUCTOR = 1660185903; + + public RecoverPassword() {} public RecoverPassword(String recoveryCode) { this.recoveryCode = recoveryCode; } - public static final int CONSTRUCTOR = 1660185903; + public RecoverPassword(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var recoveryCodeTmp = new byte[input.readInt()]; + input.readFully(recoveryCodeTmp); + this.recoveryCode = new String(recoveryCodeTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.recoveryCode == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var recoveryCodeTmp = this.recoveryCode.getBytes(StandardCharsets.UTF_8); + output.writeInt(recoveryCodeTmp.length); + output.write(recoveryCodeTmp); + } + } } public static class RegisterDevice extends Function { public DeviceToken deviceToken; public int[] otherUserIds; - public RegisterDevice() { - } + public static final int CONSTRUCTOR = 1734127493; + + public RegisterDevice() {} public RegisterDevice(DeviceToken deviceToken, int[] otherUserIds) { this.deviceToken = deviceToken; this.otherUserIds = otherUserIds; } - public static final int CONSTRUCTOR = 1734127493; + public RegisterDevice(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case DeviceTokenFirebaseCloudMessaging.CONSTRUCTOR: + this.deviceToken = new DeviceTokenFirebaseCloudMessaging(input); + break; + case DeviceTokenApplePush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenApplePush(input); + break; + case DeviceTokenApplePushVoIP.CONSTRUCTOR: + this.deviceToken = new DeviceTokenApplePushVoIP(input); + break; + case DeviceTokenWindowsPush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenWindowsPush(input); + break; + case DeviceTokenMicrosoftPush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenMicrosoftPush(input); + break; + case DeviceTokenMicrosoftPushVoIP.CONSTRUCTOR: + this.deviceToken = new DeviceTokenMicrosoftPushVoIP(input); + break; + case DeviceTokenWebPush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenWebPush(input); + break; + case DeviceTokenSimplePush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenSimplePush(input); + break; + case DeviceTokenUbuntuPush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenUbuntuPush(input); + break; + case DeviceTokenBlackBerryPush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenBlackBerryPush(input); + break; + case DeviceTokenTizenPush.CONSTRUCTOR: + this.deviceToken = new DeviceTokenTizenPush(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.otherUserIds = new int[input.readInt()]; + for (int i = 0; i < this.otherUserIds.length; i++) { + this.otherUserIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.deviceToken == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.deviceToken.serialize(output); + } + output.writeInt(this.otherUserIds.length); + for (int i = 0; i < this.otherUserIds.length; i++) { + output.writeInt(this.otherUserIds[i]); + } + } } public static class RegisterUser extends Function { public String firstName; public String lastName; - public RegisterUser() { - } + public static final int CONSTRUCTOR = -109994467; + + public RegisterUser() {} public RegisterUser(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } - public static final int CONSTRUCTOR = -109994467; + public RegisterUser(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var firstNameTmp = new byte[input.readInt()]; + input.readFully(firstNameTmp); + this.firstName = new String(firstNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var lastNameTmp = new byte[input.readInt()]; + input.readFully(lastNameTmp); + this.lastName = new String(lastNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.firstName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var firstNameTmp = this.firstName.getBytes(StandardCharsets.UTF_8); + output.writeInt(firstNameTmp.length); + output.write(firstNameTmp); + } + if (this.lastName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var lastNameTmp = this.lastName.getBytes(StandardCharsets.UTF_8); + output.writeInt(lastNameTmp.length); + output.write(lastNameTmp); + } + } } public static class RemoveBackground extends Function { public long backgroundId; - public RemoveBackground() { - } + public static final int CONSTRUCTOR = -1484545642; + + public RemoveBackground() {} public RemoveBackground(long backgroundId) { this.backgroundId = backgroundId; } - public static final int CONSTRUCTOR = -1484545642; + public RemoveBackground(DataInputStream input) throws IOException { + this.backgroundId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.backgroundId); + } } public static class RemoveChatActionBar extends Function { public long chatId; - public RemoveChatActionBar() { - } + public static final int CONSTRUCTOR = -1650968070; + + public RemoveChatActionBar() {} public RemoveChatActionBar(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = -1650968070; + public RemoveChatActionBar(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class RemoveContacts extends Function { public int[] userIds; - public RemoveContacts() { - } + public static final int CONSTRUCTOR = -615510759; + + public RemoveContacts() {} public RemoveContacts(int[] userIds) { this.userIds = userIds; } - public static final int CONSTRUCTOR = -615510759; + public RemoveContacts(DataInputStream input) throws IOException { + this.userIds = new int[input.readInt()]; + for (int i = 0; i < this.userIds.length; i++) { + this.userIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userIds.length); + for (int i = 0; i < this.userIds.length; i++) { + output.writeInt(this.userIds[i]); + } + } } public static class RemoveFavoriteSticker extends Function { public InputFile sticker; - public RemoveFavoriteSticker() { - } + public static final int CONSTRUCTOR = 1152945264; + + public RemoveFavoriteSticker() {} public RemoveFavoriteSticker(InputFile sticker) { this.sticker = sticker; } - public static final int CONSTRUCTOR = 1152945264; + public RemoveFavoriteSticker(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class RemoveNotification extends Function { public int notificationGroupId; public int notificationId; - public RemoveNotification() { - } + public static final int CONSTRUCTOR = 862630734; + + public RemoveNotification() {} public RemoveNotification(int notificationGroupId, int notificationId) { this.notificationGroupId = notificationGroupId; this.notificationId = notificationId; } - public static final int CONSTRUCTOR = 862630734; + public RemoveNotification(DataInputStream input) throws IOException { + this.notificationGroupId = input.readInt(); + this.notificationId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.notificationGroupId); + output.writeInt(this.notificationId); + } } public static class RemoveNotificationGroup extends Function { public int notificationGroupId; public int maxNotificationId; - public RemoveNotificationGroup() { - } + public static final int CONSTRUCTOR = 1713005454; + + public RemoveNotificationGroup() {} public RemoveNotificationGroup(int notificationGroupId, int maxNotificationId) { this.notificationGroupId = notificationGroupId; this.maxNotificationId = maxNotificationId; } - public static final int CONSTRUCTOR = 1713005454; + public RemoveNotificationGroup(DataInputStream input) throws IOException { + this.notificationGroupId = input.readInt(); + this.maxNotificationId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.notificationGroupId); + output.writeInt(this.maxNotificationId); + } } public static class RemoveProxy extends Function { public int proxyId; - public RemoveProxy() { - } + public static final int CONSTRUCTOR = 1369219847; + + public RemoveProxy() {} public RemoveProxy(int proxyId) { this.proxyId = proxyId; } - public static final int CONSTRUCTOR = 1369219847; + public RemoveProxy(DataInputStream input) throws IOException { + this.proxyId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.proxyId); + } } public static class RemoveRecentHashtag extends Function { public String hashtag; - public RemoveRecentHashtag() { - } + public static final int CONSTRUCTOR = -1013735260; + + public RemoveRecentHashtag() {} public RemoveRecentHashtag(String hashtag) { this.hashtag = hashtag; } - public static final int CONSTRUCTOR = -1013735260; + public RemoveRecentHashtag(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var hashtagTmp = new byte[input.readInt()]; + input.readFully(hashtagTmp); + this.hashtag = new String(hashtagTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.hashtag == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var hashtagTmp = this.hashtag.getBytes(StandardCharsets.UTF_8); + output.writeInt(hashtagTmp.length); + output.write(hashtagTmp); + } + } } public static class RemoveRecentSticker extends Function { public boolean isAttached; public InputFile sticker; - public RemoveRecentSticker() { - } + public static final int CONSTRUCTOR = 1246577677; + + public RemoveRecentSticker() {} public RemoveRecentSticker(boolean isAttached, InputFile sticker) { this.isAttached = isAttached; this.sticker = sticker; } - public static final int CONSTRUCTOR = 1246577677; + public RemoveRecentSticker(DataInputStream input) throws IOException { + this.isAttached = input.readBoolean(); + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isAttached); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class RemoveRecentlyFoundChat extends Function { public long chatId; - public RemoveRecentlyFoundChat() { - } + public static final int CONSTRUCTOR = 717340444; + + public RemoveRecentlyFoundChat() {} public RemoveRecentlyFoundChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 717340444; + public RemoveRecentlyFoundChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class RemoveSavedAnimation extends Function { public InputFile animation; - public RemoveSavedAnimation() { - } + public static final int CONSTRUCTOR = -495605479; + + public RemoveSavedAnimation() {} public RemoveSavedAnimation(InputFile animation) { this.animation = animation; } - public static final int CONSTRUCTOR = -495605479; + public RemoveSavedAnimation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.animation = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.animation = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.animation = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.animation = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.animation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.animation.serialize(output); + } + } } public static class RemoveStickerFromSet extends Function { public InputFile sticker; - public RemoveStickerFromSet() { - } + public static final int CONSTRUCTOR = 1642196644; + + public RemoveStickerFromSet() {} public RemoveStickerFromSet(InputFile sticker) { this.sticker = sticker; } - public static final int CONSTRUCTOR = 1642196644; + public RemoveStickerFromSet(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + } } public static class RemoveTopChat extends Function { public TopChatCategory category; public long chatId; - public RemoveTopChat() { - } + public static final int CONSTRUCTOR = -1907876267; + + public RemoveTopChat() {} public RemoveTopChat(TopChatCategory category, long chatId) { this.category = category; this.chatId = chatId; } - public static final int CONSTRUCTOR = -1907876267; + public RemoveTopChat(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case TopChatCategoryUsers.CONSTRUCTOR: + this.category = new TopChatCategoryUsers(input); + break; + case TopChatCategoryBots.CONSTRUCTOR: + this.category = new TopChatCategoryBots(input); + break; + case TopChatCategoryGroups.CONSTRUCTOR: + this.category = new TopChatCategoryGroups(input); + break; + case TopChatCategoryChannels.CONSTRUCTOR: + this.category = new TopChatCategoryChannels(input); + break; + case TopChatCategoryInlineBots.CONSTRUCTOR: + this.category = new TopChatCategoryInlineBots(input); + break; + case TopChatCategoryCalls.CONSTRUCTOR: + this.category = new TopChatCategoryCalls(input); + break; + case TopChatCategoryForwardChats.CONSTRUCTOR: + this.category = new TopChatCategoryForwardChats(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.category == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.category.serialize(output); + } + output.writeLong(this.chatId); + } } public static class ReorderInstalledStickerSets extends Function { public boolean isMasks; public long[] stickerSetIds; - public ReorderInstalledStickerSets() { - } + public static final int CONSTRUCTOR = 1114537563; + + public ReorderInstalledStickerSets() {} public ReorderInstalledStickerSets(boolean isMasks, long[] stickerSetIds) { this.isMasks = isMasks; this.stickerSetIds = stickerSetIds; } - public static final int CONSTRUCTOR = 1114537563; + public ReorderInstalledStickerSets(DataInputStream input) throws IOException { + this.isMasks = input.readBoolean(); + this.stickerSetIds = new long[input.readInt()]; + for (int i = 0; i < this.stickerSetIds.length; i++) { + this.stickerSetIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isMasks); + output.writeInt(this.stickerSetIds.length); + for (int i = 0; i < this.stickerSetIds.length; i++) { + output.writeLong(this.stickerSetIds[i]); + } + } } public static class ReportChat extends Function { @@ -19943,8 +49005,9 @@ public class TdApi { public ChatReportReason reason; public long[] messageIds; - public ReportChat() { - } + public static final int CONSTRUCTOR = -312579772; + + public ReportChat() {} public ReportChat(long chatId, ChatReportReason reason, long[] messageIds) { this.chatId = chatId; @@ -19952,12 +49015,59 @@ public class TdApi { this.messageIds = messageIds; } - public static final int CONSTRUCTOR = -312579772; + public ReportChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatReportReasonSpam.CONSTRUCTOR: + this.reason = new ChatReportReasonSpam(input); + break; + case ChatReportReasonViolence.CONSTRUCTOR: + this.reason = new ChatReportReasonViolence(input); + break; + case ChatReportReasonPornography.CONSTRUCTOR: + this.reason = new ChatReportReasonPornography(input); + break; + case ChatReportReasonChildAbuse.CONSTRUCTOR: + this.reason = new ChatReportReasonChildAbuse(input); + break; + case ChatReportReasonCopyright.CONSTRUCTOR: + this.reason = new ChatReportReasonCopyright(input); + break; + case ChatReportReasonUnrelatedLocation.CONSTRUCTOR: + this.reason = new ChatReportReasonUnrelatedLocation(input); + break; + case ChatReportReasonCustom.CONSTRUCTOR: + this.reason = new ChatReportReasonCustom(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.reason == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.reason.serialize(output); + } + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + } } public static class ReportSupergroupSpam extends Function { @@ -19965,8 +49075,9 @@ public class TdApi { public int userId; public long[] messageIds; - public ReportSupergroupSpam() { - } + public static final int CONSTRUCTOR = -2125451498; + + public ReportSupergroupSpam() {} public ReportSupergroupSpam(int supergroupId, int userId, long[] messageIds) { this.supergroupId = supergroupId; @@ -19974,193 +49085,292 @@ public class TdApi { this.messageIds = messageIds; } - public static final int CONSTRUCTOR = -2125451498; + public ReportSupergroupSpam(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + this.userId = input.readInt(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + output.writeInt(this.userId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + } } public static class RequestAuthenticationPasswordRecovery extends Function { - - public RequestAuthenticationPasswordRecovery() { - } - public static final int CONSTRUCTOR = 1393896118; - @Override + public RequestAuthenticationPasswordRecovery() {} + + + public RequestAuthenticationPasswordRecovery(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class RequestPasswordRecovery extends Function { - - public RequestPasswordRecovery() { - } - public static final int CONSTRUCTOR = -13777582; - @Override + public RequestPasswordRecovery() {} + + + public RequestPasswordRecovery(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class RequestQrCodeAuthentication extends Function { public int[] otherUserIds; - public RequestQrCodeAuthentication() { - } + public static final int CONSTRUCTOR = -104224560; + + public RequestQrCodeAuthentication() {} public RequestQrCodeAuthentication(int[] otherUserIds) { this.otherUserIds = otherUserIds; } - public static final int CONSTRUCTOR = -104224560; + public RequestQrCodeAuthentication(DataInputStream input) throws IOException { + this.otherUserIds = new int[input.readInt()]; + for (int i = 0; i < this.otherUserIds.length; i++) { + this.otherUserIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.otherUserIds.length); + for (int i = 0; i < this.otherUserIds.length; i++) { + output.writeInt(this.otherUserIds[i]); + } + } } public static class ResendAuthenticationCode extends Function { - - public ResendAuthenticationCode() { - } - public static final int CONSTRUCTOR = -814377191; - @Override + public ResendAuthenticationCode() {} + + + public ResendAuthenticationCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResendChangePhoneNumberCode extends Function { - - public ResendChangePhoneNumberCode() { - } - public static final int CONSTRUCTOR = -786772060; - @Override + public ResendChangePhoneNumberCode() {} + + + public ResendChangePhoneNumberCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResendEmailAddressVerificationCode extends Function { - - public ResendEmailAddressVerificationCode() { - } - public static final int CONSTRUCTOR = -1872416732; - @Override + public ResendEmailAddressVerificationCode() {} + + + public ResendEmailAddressVerificationCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResendMessages extends Function { public long chatId; public long[] messageIds; - public ResendMessages() { - } + public static final int CONSTRUCTOR = -940655817; + + public ResendMessages() {} public ResendMessages(long chatId, long[] messageIds) { this.chatId = chatId; this.messageIds = messageIds; } - public static final int CONSTRUCTOR = -940655817; + public ResendMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + } } public static class ResendPhoneNumberConfirmationCode extends Function { - - public ResendPhoneNumberConfirmationCode() { - } - public static final int CONSTRUCTOR = 2069068522; - @Override + public ResendPhoneNumberConfirmationCode() {} + + + public ResendPhoneNumberConfirmationCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResendPhoneNumberVerificationCode extends Function { - - public ResendPhoneNumberVerificationCode() { - } - public static final int CONSTRUCTOR = 1367629820; - @Override + public ResendPhoneNumberVerificationCode() {} + + + public ResendPhoneNumberVerificationCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResendRecoveryEmailAddressCode extends Function { - - public ResendRecoveryEmailAddressCode() { - } - public static final int CONSTRUCTOR = 433483548; - @Override + public ResendRecoveryEmailAddressCode() {} + + + public ResendRecoveryEmailAddressCode(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResetAllNotificationSettings extends Function { - - public ResetAllNotificationSettings() { - } - public static final int CONSTRUCTOR = -174020359; - @Override + public ResetAllNotificationSettings() {} + + + public ResetAllNotificationSettings(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResetBackgrounds extends Function { - - public ResetBackgrounds() { - } - public static final int CONSTRUCTOR = 204852088; - @Override + public ResetBackgrounds() {} + + + public ResetBackgrounds(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ResetNetworkStatistics extends Function { - - public ResetNetworkStatistics() { - } - public static final int CONSTRUCTOR = 1646452102; - @Override + public ResetNetworkStatistics() {} + + + public ResetNetworkStatistics(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class SaveApplicationLogEvent extends Function { @@ -20168,8 +49378,9 @@ public class TdApi { public long chatId; public JsonValue data; - public SaveApplicationLogEvent() { - } + public static final int CONSTRUCTOR = -811154930; + + public SaveApplicationLogEvent() {} public SaveApplicationLogEvent(String type, long chatId, JsonValue data) { this.type = type; @@ -20177,30 +49388,97 @@ public class TdApi { this.data = data; } - public static final int CONSTRUCTOR = -811154930; + public SaveApplicationLogEvent(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var typeTmp = new byte[input.readInt()]; + input.readFully(typeTmp); + this.type = new String(typeTmp, StandardCharsets.UTF_8); + } + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case JsonValueNull.CONSTRUCTOR: + this.data = new JsonValueNull(input); + break; + case JsonValueBoolean.CONSTRUCTOR: + this.data = new JsonValueBoolean(input); + break; + case JsonValueNumber.CONSTRUCTOR: + this.data = new JsonValueNumber(input); + break; + case JsonValueString.CONSTRUCTOR: + this.data = new JsonValueString(input); + break; + case JsonValueArray.CONSTRUCTOR: + this.data = new JsonValueArray(input); + break; + case JsonValueObject.CONSTRUCTOR: + this.data = new JsonValueObject(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var typeTmp = this.type.getBytes(StandardCharsets.UTF_8); + output.writeInt(typeTmp.length); + output.write(typeTmp); + } + output.writeLong(this.chatId); + if (this.data == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.data.serialize(output); + } + } } public static class SearchBackground extends Function { public String name; - public SearchBackground() { - } + public static final int CONSTRUCTOR = -2130996959; + + public SearchBackground() {} public SearchBackground(String name) { this.name = name; } - public static final int CONSTRUCTOR = -2130996959; + public SearchBackground(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + } } public static class SearchCallMessages extends Function { @@ -20208,8 +49486,9 @@ public class TdApi { public int limit; public boolean onlyMissed; - public SearchCallMessages() { - } + public static final int CONSTRUCTOR = -1077230820; + + public SearchCallMessages() {} public SearchCallMessages(long fromMessageId, int limit, boolean onlyMissed) { this.fromMessageId = fromMessageId; @@ -20217,12 +49496,22 @@ public class TdApi { this.onlyMissed = onlyMissed; } - public static final int CONSTRUCTOR = -1077230820; + public SearchCallMessages(DataInputStream input) throws IOException { + this.fromMessageId = input.readLong(); + this.limit = input.readInt(); + this.onlyMissed = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.fromMessageId); + output.writeInt(this.limit); + output.writeBoolean(this.onlyMissed); + } } public static class SearchChatMembers extends Function { @@ -20231,8 +49520,9 @@ public class TdApi { public int limit; public ChatMembersFilter filter; - public SearchChatMembers() { - } + public static final int CONSTRUCTOR = -445823291; + + public SearchChatMembers() {} public SearchChatMembers(long chatId, String query, int limit, ChatMembersFilter filter) { this.chatId = chatId; @@ -20241,12 +49531,63 @@ public class TdApi { this.filter = filter; } - public static final int CONSTRUCTOR = -445823291; + public SearchChatMembers(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMembersFilterContacts.CONSTRUCTOR: + this.filter = new ChatMembersFilterContacts(input); + break; + case ChatMembersFilterAdministrators.CONSTRUCTOR: + this.filter = new ChatMembersFilterAdministrators(input); + break; + case ChatMembersFilterMembers.CONSTRUCTOR: + this.filter = new ChatMembersFilterMembers(input); + break; + case ChatMembersFilterRestricted.CONSTRUCTOR: + this.filter = new ChatMembersFilterRestricted(input); + break; + case ChatMembersFilterBanned.CONSTRUCTOR: + this.filter = new ChatMembersFilterBanned(input); + break; + case ChatMembersFilterBots.CONSTRUCTOR: + this.filter = new ChatMembersFilterBots(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.limit); + if (this.filter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.filter.serialize(output); + } + } } public static class SearchChatMessages extends Function { @@ -20258,8 +49599,9 @@ public class TdApi { public int limit; public SearchMessagesFilter filter; - public SearchChatMessages() { - } + public static final int CONSTRUCTOR = -1528846671; + + public SearchChatMessages() {} public SearchChatMessages(long chatId, String query, int senderUserId, long fromMessageId, int offset, int limit, SearchMessagesFilter filter) { this.chatId = chatId; @@ -20271,110 +49613,283 @@ public class TdApi { this.filter = filter; } - public static final int CONSTRUCTOR = -1528846671; + public SearchChatMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.senderUserId = input.readInt(); + this.fromMessageId = input.readLong(); + this.offset = input.readInt(); + this.limit = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case SearchMessagesFilterEmpty.CONSTRUCTOR: + this.filter = new SearchMessagesFilterEmpty(input); + break; + case SearchMessagesFilterAnimation.CONSTRUCTOR: + this.filter = new SearchMessagesFilterAnimation(input); + break; + case SearchMessagesFilterAudio.CONSTRUCTOR: + this.filter = new SearchMessagesFilterAudio(input); + break; + case SearchMessagesFilterDocument.CONSTRUCTOR: + this.filter = new SearchMessagesFilterDocument(input); + break; + case SearchMessagesFilterPhoto.CONSTRUCTOR: + this.filter = new SearchMessagesFilterPhoto(input); + break; + case SearchMessagesFilterVideo.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVideo(input); + break; + case SearchMessagesFilterVoiceNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVoiceNote(input); + break; + case SearchMessagesFilterPhotoAndVideo.CONSTRUCTOR: + this.filter = new SearchMessagesFilterPhotoAndVideo(input); + break; + case SearchMessagesFilterUrl.CONSTRUCTOR: + this.filter = new SearchMessagesFilterUrl(input); + break; + case SearchMessagesFilterChatPhoto.CONSTRUCTOR: + this.filter = new SearchMessagesFilterChatPhoto(input); + break; + case SearchMessagesFilterCall.CONSTRUCTOR: + this.filter = new SearchMessagesFilterCall(input); + break; + case SearchMessagesFilterMissedCall.CONSTRUCTOR: + this.filter = new SearchMessagesFilterMissedCall(input); + break; + case SearchMessagesFilterVideoNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVideoNote(input); + break; + case SearchMessagesFilterVoiceAndVideoNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVoiceAndVideoNote(input); + break; + case SearchMessagesFilterMention.CONSTRUCTOR: + this.filter = new SearchMessagesFilterMention(input); + break; + case SearchMessagesFilterUnreadMention.CONSTRUCTOR: + this.filter = new SearchMessagesFilterUnreadMention(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.senderUserId); + output.writeLong(this.fromMessageId); + output.writeInt(this.offset); + output.writeInt(this.limit); + if (this.filter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.filter.serialize(output); + } + } } public static class SearchChatRecentLocationMessages extends Function { public long chatId; public int limit; - public SearchChatRecentLocationMessages() { - } + public static final int CONSTRUCTOR = 950238950; + + public SearchChatRecentLocationMessages() {} public SearchChatRecentLocationMessages(long chatId, int limit) { this.chatId = chatId; this.limit = limit; } - public static final int CONSTRUCTOR = 950238950; + public SearchChatRecentLocationMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.limit); + } } public static class SearchChats extends Function { public String query; public int limit; - public SearchChats() { - } + public static final int CONSTRUCTOR = -1879787060; + + public SearchChats() {} public SearchChats(String query, int limit) { this.query = query; this.limit = limit; } - public static final int CONSTRUCTOR = -1879787060; + public SearchChats(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.limit); + } } public static class SearchChatsNearby extends Function { public Location location; - public SearchChatsNearby() { - } + public static final int CONSTRUCTOR = -196753377; + + public SearchChatsNearby() {} public SearchChatsNearby(Location location) { this.location = location; } - public static final int CONSTRUCTOR = -196753377; + public SearchChatsNearby(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + } } public static class SearchChatsOnServer extends Function { public String query; public int limit; - public SearchChatsOnServer() { - } + public static final int CONSTRUCTOR = -1158402188; + + public SearchChatsOnServer() {} public SearchChatsOnServer(String query, int limit) { this.query = query; this.limit = limit; } - public static final int CONSTRUCTOR = -1158402188; + public SearchChatsOnServer(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.limit); + } } public static class SearchContacts extends Function { public String query; public int limit; - public SearchContacts() { - } + public static final int CONSTRUCTOR = -1794690715; + + public SearchContacts() {} public SearchContacts(String query, int limit) { this.query = query; this.limit = limit; } - public static final int CONSTRUCTOR = -1794690715; + public SearchContacts(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.limit); + } } public static class SearchEmojis extends Function { @@ -20382,8 +49897,9 @@ public class TdApi { public boolean exactMatch; public String[] inputLanguageCodes; - public SearchEmojis() { - } + public static final int CONSTRUCTOR = 398837927; + + public SearchEmojis() {} public SearchEmojis(String text, boolean exactMatch, String[] inputLanguageCodes) { this.text = text; @@ -20391,32 +49907,83 @@ public class TdApi { this.inputLanguageCodes = inputLanguageCodes; } - public static final int CONSTRUCTOR = 398837927; + public SearchEmojis(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var textTmp = new byte[input.readInt()]; + input.readFully(textTmp); + this.text = new String(textTmp, StandardCharsets.UTF_8); + } + this.exactMatch = input.readBoolean(); + this.inputLanguageCodes = new String[input.readInt()]; + for (int i = 0; i < this.inputLanguageCodes.length; i++) { + var inputLanguageCodesTmp = new byte[input.readInt()]; + input.readFully(inputLanguageCodesTmp); + this.inputLanguageCodes[i] = new String(inputLanguageCodesTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.text == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var textTmp = this.text.getBytes(StandardCharsets.UTF_8); + output.writeInt(textTmp.length); + output.write(textTmp); + } + output.writeBoolean(this.exactMatch); + output.writeInt(this.inputLanguageCodes.length); + for (int i = 0; i < this.inputLanguageCodes.length; i++) { + var inputLanguageCodesTmp = this.inputLanguageCodes[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(inputLanguageCodesTmp.length); + output.write(inputLanguageCodesTmp); + } + } } public static class SearchHashtags extends Function { public String prefix; public int limit; - public SearchHashtags() { - } + public static final int CONSTRUCTOR = 1043637617; + + public SearchHashtags() {} public SearchHashtags(String prefix, int limit) { this.prefix = prefix; this.limit = limit; } - public static final int CONSTRUCTOR = 1043637617; + public SearchHashtags(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var prefixTmp = new byte[input.readInt()]; + input.readFully(prefixTmp); + this.prefix = new String(prefixTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.prefix == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var prefixTmp = this.prefix.getBytes(StandardCharsets.UTF_8); + output.writeInt(prefixTmp.length); + output.write(prefixTmp); + } + output.writeInt(this.limit); + } } public static class SearchInstalledStickerSets extends Function { @@ -20424,8 +49991,9 @@ public class TdApi { public String query; public int limit; - public SearchInstalledStickerSets() { - } + public static final int CONSTRUCTOR = 681171344; + + public SearchInstalledStickerSets() {} public SearchInstalledStickerSets(boolean isMasks, String query, int limit) { this.isMasks = isMasks; @@ -20433,12 +50001,33 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = 681171344; + public SearchInstalledStickerSets(DataInputStream input) throws IOException { + this.isMasks = input.readBoolean(); + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeBoolean(this.isMasks); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.limit); + } } public static class SearchMessages extends Function { @@ -20449,8 +50038,9 @@ public class TdApi { public long offsetMessageId; public int limit; - public SearchMessages() { - } + public static final int CONSTRUCTOR = -455843835; + + public SearchMessages() {} public SearchMessages(ChatList chatList, String query, int offsetDate, long offsetChatId, long offsetMessageId, int limit) { this.chatList = chatList; @@ -20461,48 +50051,127 @@ public class TdApi { this.limit = limit; } - public static final int CONSTRUCTOR = -455843835; + public SearchMessages(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.offsetDate = input.readInt(); + this.offsetChatId = input.readLong(); + this.offsetMessageId = input.readLong(); + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeInt(this.offsetDate); + output.writeLong(this.offsetChatId); + output.writeLong(this.offsetMessageId); + output.writeInt(this.limit); + } } public static class SearchPublicChat extends Function { public String username; - public SearchPublicChat() { - } + public static final int CONSTRUCTOR = 857135533; + + public SearchPublicChat() {} public SearchPublicChat(String username) { this.username = username; } - public static final int CONSTRUCTOR = 857135533; + public SearchPublicChat(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + } } public static class SearchPublicChats extends Function { public String query; - public SearchPublicChats() { - } + public static final int CONSTRUCTOR = 970385337; + + public SearchPublicChats() {} public SearchPublicChats(String query) { this.query = query; } - public static final int CONSTRUCTOR = 970385337; + public SearchPublicChats(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + } } public static class SearchSecretMessages extends Function { @@ -20512,8 +50181,9 @@ public class TdApi { public int limit; public SearchMessagesFilter filter; - public SearchSecretMessages() { - } + public static final int CONSTRUCTOR = -1670627915; + + public SearchSecretMessages() {} public SearchSecretMessages(long chatId, String query, long fromSearchId, int limit, SearchMessagesFilter filter) { this.chatId = chatId; @@ -20523,68 +50193,207 @@ public class TdApi { this.filter = filter; } - public static final int CONSTRUCTOR = -1670627915; + public SearchSecretMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + this.fromSearchId = input.readLong(); + this.limit = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case SearchMessagesFilterEmpty.CONSTRUCTOR: + this.filter = new SearchMessagesFilterEmpty(input); + break; + case SearchMessagesFilterAnimation.CONSTRUCTOR: + this.filter = new SearchMessagesFilterAnimation(input); + break; + case SearchMessagesFilterAudio.CONSTRUCTOR: + this.filter = new SearchMessagesFilterAudio(input); + break; + case SearchMessagesFilterDocument.CONSTRUCTOR: + this.filter = new SearchMessagesFilterDocument(input); + break; + case SearchMessagesFilterPhoto.CONSTRUCTOR: + this.filter = new SearchMessagesFilterPhoto(input); + break; + case SearchMessagesFilterVideo.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVideo(input); + break; + case SearchMessagesFilterVoiceNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVoiceNote(input); + break; + case SearchMessagesFilterPhotoAndVideo.CONSTRUCTOR: + this.filter = new SearchMessagesFilterPhotoAndVideo(input); + break; + case SearchMessagesFilterUrl.CONSTRUCTOR: + this.filter = new SearchMessagesFilterUrl(input); + break; + case SearchMessagesFilterChatPhoto.CONSTRUCTOR: + this.filter = new SearchMessagesFilterChatPhoto(input); + break; + case SearchMessagesFilterCall.CONSTRUCTOR: + this.filter = new SearchMessagesFilterCall(input); + break; + case SearchMessagesFilterMissedCall.CONSTRUCTOR: + this.filter = new SearchMessagesFilterMissedCall(input); + break; + case SearchMessagesFilterVideoNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVideoNote(input); + break; + case SearchMessagesFilterVoiceAndVideoNote.CONSTRUCTOR: + this.filter = new SearchMessagesFilterVoiceAndVideoNote(input); + break; + case SearchMessagesFilterMention.CONSTRUCTOR: + this.filter = new SearchMessagesFilterMention(input); + break; + case SearchMessagesFilterUnreadMention.CONSTRUCTOR: + this.filter = new SearchMessagesFilterUnreadMention(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + output.writeLong(this.fromSearchId); + output.writeInt(this.limit); + if (this.filter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.filter.serialize(output); + } + } } public static class SearchStickerSet extends Function { public String name; - public SearchStickerSet() { - } + public static final int CONSTRUCTOR = 1157930222; + + public SearchStickerSet() {} public SearchStickerSet(String name) { this.name = name; } - public static final int CONSTRUCTOR = 1157930222; + public SearchStickerSet(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + } } public static class SearchStickerSets extends Function { public String query; - public SearchStickerSets() { - } + public static final int CONSTRUCTOR = -1082314629; + + public SearchStickerSets() {} public SearchStickerSets(String query) { this.query = query; } - public static final int CONSTRUCTOR = -1082314629; + public SearchStickerSets(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var queryTmp = new byte[input.readInt()]; + input.readFully(queryTmp); + this.query = new String(queryTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.query == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var queryTmp = this.query.getBytes(StandardCharsets.UTF_8); + output.writeInt(queryTmp.length); + output.write(queryTmp); + } + } } public static class SearchStickers extends Function { public String emoji; public int limit; - public SearchStickers() { - } + public static final int CONSTRUCTOR = 1555771203; + + public SearchStickers() {} public SearchStickers(String emoji, int limit) { this.emoji = emoji; this.limit = limit; } - public static final int CONSTRUCTOR = 1555771203; + public SearchStickers(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emojiTmp = new byte[input.readInt()]; + input.readFully(emojiTmp); + this.emoji = new String(emojiTmp, StandardCharsets.UTF_8); + } + this.limit = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emoji == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emojiTmp = this.emoji.getBytes(StandardCharsets.UTF_8); + output.writeInt(emojiTmp.length); + output.write(emojiTmp); + } + output.writeInt(this.limit); + } } public static class SendBotStartMessage extends Function { @@ -20592,8 +50401,9 @@ public class TdApi { public long chatId; public String parameter; - public SendBotStartMessage() { - } + public static final int CONSTRUCTOR = 1112181339; + + public SendBotStartMessage() {} public SendBotStartMessage(int botUserId, long chatId, String parameter) { this.botUserId = botUserId; @@ -20601,32 +50411,73 @@ public class TdApi { this.parameter = parameter; } - public static final int CONSTRUCTOR = 1112181339; + public SendBotStartMessage(DataInputStream input) throws IOException { + this.botUserId = input.readInt(); + this.chatId = input.readLong(); + if (input.readBoolean()) { + var parameterTmp = new byte[input.readInt()]; + input.readFully(parameterTmp); + this.parameter = new String(parameterTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.botUserId); + output.writeLong(this.chatId); + if (this.parameter == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var parameterTmp = this.parameter.getBytes(StandardCharsets.UTF_8); + output.writeInt(parameterTmp.length); + output.write(parameterTmp); + } + } } public static class SendCallDebugInformation extends Function { public int callId; public String debugInformation; - public SendCallDebugInformation() { - } + public static final int CONSTRUCTOR = 2019243839; + + public SendCallDebugInformation() {} public SendCallDebugInformation(int callId, String debugInformation) { this.callId = callId; this.debugInformation = debugInformation; } - public static final int CONSTRUCTOR = 2019243839; + public SendCallDebugInformation(DataInputStream input) throws IOException { + this.callId = input.readInt(); + if (input.readBoolean()) { + var debugInformationTmp = new byte[input.readInt()]; + input.readFully(debugInformationTmp); + this.debugInformation = new String(debugInformationTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.callId); + if (this.debugInformation == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var debugInformationTmp = this.debugInformation.getBytes(StandardCharsets.UTF_8); + output.writeInt(debugInformationTmp.length); + output.write(debugInformationTmp); + } + } } public static class SendCallRating extends Function { @@ -20635,8 +50486,9 @@ public class TdApi { public String comment; public CallProblem[] problems; - public SendCallRating() { - } + public static final int CONSTRUCTOR = -1402719502; + + public SendCallRating() {} public SendCallRating(int callId, int rating, String comment, CallProblem[] problems) { this.callId = callId; @@ -20645,108 +50497,284 @@ public class TdApi { this.problems = problems; } - public static final int CONSTRUCTOR = -1402719502; + public SendCallRating(DataInputStream input) throws IOException { + this.callId = input.readInt(); + this.rating = input.readInt(); + if (input.readBoolean()) { + var commentTmp = new byte[input.readInt()]; + input.readFully(commentTmp); + this.comment = new String(commentTmp, StandardCharsets.UTF_8); + } + this.problems = new CallProblem[input.readInt()]; + for (int i = 0; i < this.problems.length; i++) { + switch(input.readInt()) { + case CallProblemEcho.CONSTRUCTOR: + this.problems[i] = new CallProblemEcho(input); + break; + case CallProblemNoise.CONSTRUCTOR: + this.problems[i] = new CallProblemNoise(input); + break; + case CallProblemInterruptions.CONSTRUCTOR: + this.problems[i] = new CallProblemInterruptions(input); + break; + case CallProblemDistortedSpeech.CONSTRUCTOR: + this.problems[i] = new CallProblemDistortedSpeech(input); + break; + case CallProblemSilentLocal.CONSTRUCTOR: + this.problems[i] = new CallProblemSilentLocal(input); + break; + case CallProblemSilentRemote.CONSTRUCTOR: + this.problems[i] = new CallProblemSilentRemote(input); + break; + case CallProblemDropped.CONSTRUCTOR: + this.problems[i] = new CallProblemDropped(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.callId); + output.writeInt(this.rating); + if (this.comment == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var commentTmp = this.comment.getBytes(StandardCharsets.UTF_8); + output.writeInt(commentTmp.length); + output.write(commentTmp); + } + output.writeInt(this.problems.length); + for (int i = 0; i < this.problems.length; i++) { + this.problems[i].serialize(output); + } + } } public static class SendChatAction extends Function { public long chatId; public ChatAction action; - public SendChatAction() { - } + public static final int CONSTRUCTOR = -841357536; + + public SendChatAction() {} public SendChatAction(long chatId, ChatAction action) { this.chatId = chatId; this.action = action; } - public static final int CONSTRUCTOR = -841357536; + public SendChatAction(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatActionTyping.CONSTRUCTOR: + this.action = new ChatActionTyping(input); + break; + case ChatActionRecordingVideo.CONSTRUCTOR: + this.action = new ChatActionRecordingVideo(input); + break; + case ChatActionUploadingVideo.CONSTRUCTOR: + this.action = new ChatActionUploadingVideo(input); + break; + case ChatActionRecordingVoiceNote.CONSTRUCTOR: + this.action = new ChatActionRecordingVoiceNote(input); + break; + case ChatActionUploadingVoiceNote.CONSTRUCTOR: + this.action = new ChatActionUploadingVoiceNote(input); + break; + case ChatActionUploadingPhoto.CONSTRUCTOR: + this.action = new ChatActionUploadingPhoto(input); + break; + case ChatActionUploadingDocument.CONSTRUCTOR: + this.action = new ChatActionUploadingDocument(input); + break; + case ChatActionChoosingLocation.CONSTRUCTOR: + this.action = new ChatActionChoosingLocation(input); + break; + case ChatActionChoosingContact.CONSTRUCTOR: + this.action = new ChatActionChoosingContact(input); + break; + case ChatActionStartPlayingGame.CONSTRUCTOR: + this.action = new ChatActionStartPlayingGame(input); + break; + case ChatActionRecordingVideoNote.CONSTRUCTOR: + this.action = new ChatActionRecordingVideoNote(input); + break; + case ChatActionUploadingVideoNote.CONSTRUCTOR: + this.action = new ChatActionUploadingVideoNote(input); + break; + case ChatActionCancel.CONSTRUCTOR: + this.action = new ChatActionCancel(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.action == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.action.serialize(output); + } + } } public static class SendChatScreenshotTakenNotification extends Function { public long chatId; - public SendChatScreenshotTakenNotification() { - } + public static final int CONSTRUCTOR = 448399457; + + public SendChatScreenshotTakenNotification() {} public SendChatScreenshotTakenNotification(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 448399457; + public SendChatScreenshotTakenNotification(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class SendChatSetTtlMessage extends Function { public long chatId; public int ttl; - public SendChatSetTtlMessage() { - } + public static final int CONSTRUCTOR = 1432535564; + + public SendChatSetTtlMessage() {} public SendChatSetTtlMessage(long chatId, int ttl) { this.chatId = chatId; this.ttl = ttl; } - public static final int CONSTRUCTOR = 1432535564; + public SendChatSetTtlMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.ttl = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.ttl); + } } public static class SendCustomRequest extends Function { public String method; public String parameters; - public SendCustomRequest() { - } + public static final int CONSTRUCTOR = 285045153; + + public SendCustomRequest() {} public SendCustomRequest(String method, String parameters) { this.method = method; this.parameters = parameters; } - public static final int CONSTRUCTOR = 285045153; + public SendCustomRequest(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var methodTmp = new byte[input.readInt()]; + input.readFully(methodTmp); + this.method = new String(methodTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var parametersTmp = new byte[input.readInt()]; + input.readFully(parametersTmp); + this.parameters = new String(parametersTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.method == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var methodTmp = this.method.getBytes(StandardCharsets.UTF_8); + output.writeInt(methodTmp.length); + output.write(methodTmp); + } + if (this.parameters == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var parametersTmp = this.parameters.getBytes(StandardCharsets.UTF_8); + output.writeInt(parametersTmp.length); + output.write(parametersTmp); + } + } } public static class SendEmailAddressVerificationCode extends Function { public String emailAddress; - public SendEmailAddressVerificationCode() { - } + public static final int CONSTRUCTOR = -221621379; + + public SendEmailAddressVerificationCode() {} public SendEmailAddressVerificationCode(String emailAddress) { this.emailAddress = emailAddress; } - public static final int CONSTRUCTOR = -221621379; + public SendEmailAddressVerificationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var emailAddressTmp = new byte[input.readInt()]; + input.readFully(emailAddressTmp); + this.emailAddress = new String(emailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.emailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var emailAddressTmp = this.emailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(emailAddressTmp.length); + output.write(emailAddressTmp); + } + } } public static class SendInlineQueryResultMessage extends Function { @@ -20757,8 +50785,9 @@ public class TdApi { public String resultId; public boolean hideViaBot; - public SendInlineQueryResultMessage() { - } + public static final int CONSTRUCTOR = 729880339; + + public SendInlineQueryResultMessage() {} public SendInlineQueryResultMessage(long chatId, long replyToMessageId, SendMessageOptions options, long queryId, String resultId, boolean hideViaBot) { this.chatId = chatId; @@ -20769,12 +50798,49 @@ public class TdApi { this.hideViaBot = hideViaBot; } - public static final int CONSTRUCTOR = 729880339; + public SendInlineQueryResultMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.replyToMessageId = input.readLong(); + if (input.readBoolean()) { + if (SendMessageOptions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.options = new SendMessageOptions(input); + } + this.queryId = input.readLong(); + if (input.readBoolean()) { + var resultIdTmp = new byte[input.readInt()]; + input.readFully(resultIdTmp); + this.resultId = new String(resultIdTmp, StandardCharsets.UTF_8); + } + this.hideViaBot = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.replyToMessageId); + if (this.options == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.options.serialize(output); + } + output.writeLong(this.queryId); + if (this.resultId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var resultIdTmp = this.resultId.getBytes(StandardCharsets.UTF_8); + output.writeInt(resultIdTmp.length); + output.write(resultIdTmp); + } + output.writeBoolean(this.hideViaBot); + } } public static class SendMessage extends Function { @@ -20784,8 +50850,9 @@ public class TdApi { public ReplyMarkup replyMarkup; public InputMessageContent inputMessageContent; - public SendMessage() { - } + public static final int CONSTRUCTOR = -1314396596; + + public SendMessage() {} public SendMessage(long chatId, long replyToMessageId, SendMessageOptions options, ReplyMarkup replyMarkup, InputMessageContent inputMessageContent) { this.chatId = chatId; @@ -20795,12 +50862,119 @@ public class TdApi { this.inputMessageContent = inputMessageContent; } - public static final int CONSTRUCTOR = -1314396596; + public SendMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.replyToMessageId = input.readLong(); + if (input.readBoolean()) { + if (SendMessageOptions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.options = new SendMessageOptions(input); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContent = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContent = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContent = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContent = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContent = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContent = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContent = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContent = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContent = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContent = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.replyToMessageId); + if (this.options == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.options.serialize(output); + } + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + if (this.inputMessageContent == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.inputMessageContent.serialize(output); + } + } } public static class SendMessageAlbum extends Function { @@ -20809,8 +50983,9 @@ public class TdApi { public SendMessageOptions options; public InputMessageContent[] inputMessageContents; - public SendMessageAlbum() { - } + public static final int CONSTRUCTOR = -818794592; + + public SendMessageAlbum() {} public SendMessageAlbum(long chatId, long replyToMessageId, SendMessageOptions options, InputMessageContent[] inputMessageContents) { this.chatId = chatId; @@ -20819,32 +50994,171 @@ public class TdApi { this.inputMessageContents = inputMessageContents; } - public static final int CONSTRUCTOR = -818794592; + public SendMessageAlbum(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.replyToMessageId = input.readLong(); + if (input.readBoolean()) { + if (SendMessageOptions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.options = new SendMessageOptions(input); + } + this.inputMessageContents = new InputMessageContent[input.readInt()]; + for (int i = 0; i < this.inputMessageContents.length; i++) { + switch(input.readInt()) { + case InputMessageText.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageText(input); + break; + case InputMessageAnimation.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageAnimation(input); + break; + case InputMessageAudio.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageAudio(input); + break; + case InputMessageDocument.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageDocument(input); + break; + case InputMessagePhoto.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessagePhoto(input); + break; + case InputMessageSticker.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageSticker(input); + break; + case InputMessageVideo.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageVideo(input); + break; + case InputMessageVideoNote.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageVideoNote(input); + break; + case InputMessageVoiceNote.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageVoiceNote(input); + break; + case InputMessageLocation.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageLocation(input); + break; + case InputMessageVenue.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageVenue(input); + break; + case InputMessageContact.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageContact(input); + break; + case InputMessageDice.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageDice(input); + break; + case InputMessageGame.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageGame(input); + break; + case InputMessageInvoice.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageInvoice(input); + break; + case InputMessagePoll.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessagePoll(input); + break; + case InputMessageForwarded.CONSTRUCTOR: + this.inputMessageContents[i] = new InputMessageForwarded(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.replyToMessageId); + if (this.options == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.options.serialize(output); + } + output.writeInt(this.inputMessageContents.length); + for (int i = 0; i < this.inputMessageContents.length; i++) { + this.inputMessageContents[i].serialize(output); + } + } } public static class SendPassportAuthorizationForm extends Function { public int autorizationFormId; public PassportElementType[] types; - public SendPassportAuthorizationForm() { - } + public static final int CONSTRUCTOR = -602402218; + + public SendPassportAuthorizationForm() {} public SendPassportAuthorizationForm(int autorizationFormId, PassportElementType[] types) { this.autorizationFormId = autorizationFormId; this.types = types; } - public static final int CONSTRUCTOR = -602402218; + public SendPassportAuthorizationForm(DataInputStream input) throws IOException { + this.autorizationFormId = input.readInt(); + this.types = new PassportElementType[input.readInt()]; + for (int i = 0; i < this.types.length; i++) { + switch(input.readInt()) { + case PassportElementTypePersonalDetails.CONSTRUCTOR: + this.types[i] = new PassportElementTypePersonalDetails(input); + break; + case PassportElementTypePassport.CONSTRUCTOR: + this.types[i] = new PassportElementTypePassport(input); + break; + case PassportElementTypeDriverLicense.CONSTRUCTOR: + this.types[i] = new PassportElementTypeDriverLicense(input); + break; + case PassportElementTypeIdentityCard.CONSTRUCTOR: + this.types[i] = new PassportElementTypeIdentityCard(input); + break; + case PassportElementTypeInternalPassport.CONSTRUCTOR: + this.types[i] = new PassportElementTypeInternalPassport(input); + break; + case PassportElementTypeAddress.CONSTRUCTOR: + this.types[i] = new PassportElementTypeAddress(input); + break; + case PassportElementTypeUtilityBill.CONSTRUCTOR: + this.types[i] = new PassportElementTypeUtilityBill(input); + break; + case PassportElementTypeBankStatement.CONSTRUCTOR: + this.types[i] = new PassportElementTypeBankStatement(input); + break; + case PassportElementTypeRentalAgreement.CONSTRUCTOR: + this.types[i] = new PassportElementTypeRentalAgreement(input); + break; + case PassportElementTypePassportRegistration.CONSTRUCTOR: + this.types[i] = new PassportElementTypePassportRegistration(input); + break; + case PassportElementTypeTemporaryRegistration.CONSTRUCTOR: + this.types[i] = new PassportElementTypeTemporaryRegistration(input); + break; + case PassportElementTypePhoneNumber.CONSTRUCTOR: + this.types[i] = new PassportElementTypePhoneNumber(input); + break; + case PassportElementTypeEmailAddress.CONSTRUCTOR: + this.types[i] = new PassportElementTypeEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.autorizationFormId); + output.writeInt(this.types.length); + for (int i = 0; i < this.types.length; i++) { + this.types[i].serialize(output); + } + } } public static class SendPaymentForm extends Function { @@ -20854,8 +51168,9 @@ public class TdApi { public String shippingOptionId; public InputCredentials credentials; - public SendPaymentForm() { - } + public static final int CONSTRUCTOR = 591581572; + + public SendPaymentForm() {} public SendPaymentForm(long chatId, long messageId, String orderInfoId, String shippingOptionId, InputCredentials credentials) { this.chatId = chatId; @@ -20865,12 +51180,70 @@ public class TdApi { this.credentials = credentials; } - public static final int CONSTRUCTOR = 591581572; + public SendPaymentForm(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + var orderInfoIdTmp = new byte[input.readInt()]; + input.readFully(orderInfoIdTmp); + this.orderInfoId = new String(orderInfoIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var shippingOptionIdTmp = new byte[input.readInt()]; + input.readFully(shippingOptionIdTmp); + this.shippingOptionId = new String(shippingOptionIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputCredentialsSaved.CONSTRUCTOR: + this.credentials = new InputCredentialsSaved(input); + break; + case InputCredentialsNew.CONSTRUCTOR: + this.credentials = new InputCredentialsNew(input); + break; + case InputCredentialsAndroidPay.CONSTRUCTOR: + this.credentials = new InputCredentialsAndroidPay(input); + break; + case InputCredentialsApplePay.CONSTRUCTOR: + this.credentials = new InputCredentialsApplePay(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.orderInfoId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var orderInfoIdTmp = this.orderInfoId.getBytes(StandardCharsets.UTF_8); + output.writeInt(orderInfoIdTmp.length); + output.write(orderInfoIdTmp); + } + if (this.shippingOptionId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var shippingOptionIdTmp = this.shippingOptionId.getBytes(StandardCharsets.UTF_8); + output.writeInt(shippingOptionIdTmp.length); + output.write(shippingOptionIdTmp); + } + if (this.credentials == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.credentials.serialize(output); + } + } } public static class SendPhoneNumberConfirmationCode extends Function { @@ -20878,8 +51251,9 @@ public class TdApi { public String phoneNumber; public PhoneNumberAuthenticationSettings settings; - public SendPhoneNumberConfirmationCode() { - } + public static final int CONSTRUCTOR = -1901171495; + + public SendPhoneNumberConfirmationCode() {} public SendPhoneNumberConfirmationCode(String hash, String phoneNumber, PhoneNumberAuthenticationSettings settings) { this.hash = hash; @@ -20887,108 +51261,278 @@ public class TdApi { this.settings = settings; } - public static final int CONSTRUCTOR = -1901171495; + public SendPhoneNumberConfirmationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var hashTmp = new byte[input.readInt()]; + input.readFully(hashTmp); + this.hash = new String(hashTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhoneNumberAuthenticationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.settings = new PhoneNumberAuthenticationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.hash == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var hashTmp = this.hash.getBytes(StandardCharsets.UTF_8); + output.writeInt(hashTmp.length); + output.write(hashTmp); + } + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.settings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.settings.serialize(output); + } + } } public static class SendPhoneNumberVerificationCode extends Function { public String phoneNumber; public PhoneNumberAuthenticationSettings settings; - public SendPhoneNumberVerificationCode() { - } + public static final int CONSTRUCTOR = 2081689035; + + public SendPhoneNumberVerificationCode() {} public SendPhoneNumberVerificationCode(String phoneNumber, PhoneNumberAuthenticationSettings settings) { this.phoneNumber = phoneNumber; this.settings = settings; } - public static final int CONSTRUCTOR = 2081689035; + public SendPhoneNumberVerificationCode(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhoneNumberAuthenticationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.settings = new PhoneNumberAuthenticationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.settings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.settings.serialize(output); + } + } } public static class SetAccountTtl extends Function { public AccountTtl ttl; - public SetAccountTtl() { - } + public static final int CONSTRUCTOR = 701389032; + + public SetAccountTtl() {} public SetAccountTtl(AccountTtl ttl) { this.ttl = ttl; } - public static final int CONSTRUCTOR = 701389032; + public SetAccountTtl(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (AccountTtl.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.ttl = new AccountTtl(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.ttl == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.ttl.serialize(output); + } + } } public static class SetAlarm extends Function { public double seconds; - public SetAlarm() { - } + public static final int CONSTRUCTOR = -873497067; + + public SetAlarm() {} public SetAlarm(double seconds) { this.seconds = seconds; } - public static final int CONSTRUCTOR = -873497067; + public SetAlarm(DataInputStream input) throws IOException { + this.seconds = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeDouble(this.seconds); + } } public static class SetAuthenticationPhoneNumber extends Function { public String phoneNumber; public PhoneNumberAuthenticationSettings settings; - public SetAuthenticationPhoneNumber() { - } + public static final int CONSTRUCTOR = 868276259; + + public SetAuthenticationPhoneNumber() {} public SetAuthenticationPhoneNumber(String phoneNumber, PhoneNumberAuthenticationSettings settings) { this.phoneNumber = phoneNumber; this.settings = settings; } - public static final int CONSTRUCTOR = 868276259; + public SetAuthenticationPhoneNumber(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var phoneNumberTmp = new byte[input.readInt()]; + input.readFully(phoneNumberTmp); + this.phoneNumber = new String(phoneNumberTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (PhoneNumberAuthenticationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.settings = new PhoneNumberAuthenticationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.phoneNumber == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var phoneNumberTmp = this.phoneNumber.getBytes(StandardCharsets.UTF_8); + output.writeInt(phoneNumberTmp.length); + output.write(phoneNumberTmp); + } + if (this.settings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.settings.serialize(output); + } + } } public static class SetAutoDownloadSettings extends Function { public AutoDownloadSettings settings; public NetworkType type; - public SetAutoDownloadSettings() { - } + public static final int CONSTRUCTOR = -353671948; + + public SetAutoDownloadSettings() {} public SetAutoDownloadSettings(AutoDownloadSettings settings, NetworkType type) { this.settings = settings; this.type = type; } - public static final int CONSTRUCTOR = -353671948; + public SetAutoDownloadSettings(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (AutoDownloadSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.settings = new AutoDownloadSettings(input); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case NetworkTypeNone.CONSTRUCTOR: + this.type = new NetworkTypeNone(input); + break; + case NetworkTypeMobile.CONSTRUCTOR: + this.type = new NetworkTypeMobile(input); + break; + case NetworkTypeMobileRoaming.CONSTRUCTOR: + this.type = new NetworkTypeMobileRoaming(input); + break; + case NetworkTypeWiFi.CONSTRUCTOR: + this.type = new NetworkTypeWiFi(input); + break; + case NetworkTypeOther.CONSTRUCTOR: + this.type = new NetworkTypeOther(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.settings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.settings.serialize(output); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class SetBackground extends Function { @@ -20996,8 +51540,9 @@ public class TdApi { public BackgroundType type; public boolean forDarkTheme; - public SetBackground() { - } + public static final int CONSTRUCTOR = -1035439225; + + public SetBackground() {} public SetBackground(InputBackground background, BackgroundType type, boolean forDarkTheme) { this.background = background; @@ -21005,170 +51550,365 @@ public class TdApi { this.forDarkTheme = forDarkTheme; } - public static final int CONSTRUCTOR = -1035439225; + public SetBackground(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputBackgroundLocal.CONSTRUCTOR: + this.background = new InputBackgroundLocal(input); + break; + case InputBackgroundRemote.CONSTRUCTOR: + this.background = new InputBackgroundRemote(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case BackgroundTypeWallpaper.CONSTRUCTOR: + this.type = new BackgroundTypeWallpaper(input); + break; + case BackgroundTypePattern.CONSTRUCTOR: + this.type = new BackgroundTypePattern(input); + break; + case BackgroundTypeFill.CONSTRUCTOR: + this.type = new BackgroundTypeFill(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.forDarkTheme = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.background == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.background.serialize(output); + } + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeBoolean(this.forDarkTheme); + } } public static class SetBio extends Function { public String bio; - public SetBio() { - } + public static final int CONSTRUCTOR = -1619582124; + + public SetBio() {} public SetBio(String bio) { this.bio = bio; } - public static final int CONSTRUCTOR = -1619582124; + public SetBio(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var bioTmp = new byte[input.readInt()]; + input.readFully(bioTmp); + this.bio = new String(bioTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.bio == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var bioTmp = this.bio.getBytes(StandardCharsets.UTF_8); + output.writeInt(bioTmp.length); + output.write(bioTmp); + } + } } public static class SetBotUpdatesStatus extends Function { public int pendingUpdateCount; public String errorMessage; - public SetBotUpdatesStatus() { - } + public static final int CONSTRUCTOR = -1154926191; + + public SetBotUpdatesStatus() {} public SetBotUpdatesStatus(int pendingUpdateCount, String errorMessage) { this.pendingUpdateCount = pendingUpdateCount; this.errorMessage = errorMessage; } - public static final int CONSTRUCTOR = -1154926191; + public SetBotUpdatesStatus(DataInputStream input) throws IOException { + this.pendingUpdateCount = input.readInt(); + if (input.readBoolean()) { + var errorMessageTmp = new byte[input.readInt()]; + input.readFully(errorMessageTmp); + this.errorMessage = new String(errorMessageTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.pendingUpdateCount); + if (this.errorMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var errorMessageTmp = this.errorMessage.getBytes(StandardCharsets.UTF_8); + output.writeInt(errorMessageTmp.length); + output.write(errorMessageTmp); + } + } } public static class SetChatChatList extends Function { public long chatId; public ChatList chatList; - public SetChatChatList() { - } + public static final int CONSTRUCTOR = -1396517321; + + public SetChatChatList() {} public SetChatChatList(long chatId, ChatList chatList) { this.chatId = chatId; this.chatList = chatList; } - public static final int CONSTRUCTOR = -1396517321; + public SetChatChatList(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + } } public static class SetChatClientData extends Function { public long chatId; public String clientData; - public SetChatClientData() { - } + public static final int CONSTRUCTOR = -827119811; + + public SetChatClientData() {} public SetChatClientData(long chatId, String clientData) { this.chatId = chatId; this.clientData = clientData; } - public static final int CONSTRUCTOR = -827119811; + public SetChatClientData(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var clientDataTmp = new byte[input.readInt()]; + input.readFully(clientDataTmp); + this.clientData = new String(clientDataTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.clientData == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var clientDataTmp = this.clientData.getBytes(StandardCharsets.UTF_8); + output.writeInt(clientDataTmp.length); + output.write(clientDataTmp); + } + } } public static class SetChatDescription extends Function { public long chatId; public String description; - public SetChatDescription() { - } + public static final int CONSTRUCTOR = 1957213277; + + public SetChatDescription() {} public SetChatDescription(long chatId, String description) { this.chatId = chatId; this.description = description; } - public static final int CONSTRUCTOR = 1957213277; + public SetChatDescription(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var descriptionTmp = new byte[input.readInt()]; + input.readFully(descriptionTmp); + this.description = new String(descriptionTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.description == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var descriptionTmp = this.description.getBytes(StandardCharsets.UTF_8); + output.writeInt(descriptionTmp.length); + output.write(descriptionTmp); + } + } } public static class SetChatDiscussionGroup extends Function { public long chatId; public long discussionChatId; - public SetChatDiscussionGroup() { - } + public static final int CONSTRUCTOR = -918801736; + + public SetChatDiscussionGroup() {} public SetChatDiscussionGroup(long chatId, long discussionChatId) { this.chatId = chatId; this.discussionChatId = discussionChatId; } - public static final int CONSTRUCTOR = -918801736; + public SetChatDiscussionGroup(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.discussionChatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.discussionChatId); + } } public static class SetChatDraftMessage extends Function { public long chatId; public DraftMessage draftMessage; - public SetChatDraftMessage() { - } + public static final int CONSTRUCTOR = -588175579; + + public SetChatDraftMessage() {} public SetChatDraftMessage(long chatId, DraftMessage draftMessage) { this.chatId = chatId; this.draftMessage = draftMessage; } - public static final int CONSTRUCTOR = -588175579; + public SetChatDraftMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (DraftMessage.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.draftMessage = new DraftMessage(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.draftMessage == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.draftMessage.serialize(output); + } + } } public static class SetChatLocation extends Function { public long chatId; public ChatLocation location; - public SetChatLocation() { - } + public static final int CONSTRUCTOR = -767091286; + + public SetChatLocation() {} public SetChatLocation(long chatId, ChatLocation location) { this.chatId = chatId; this.location = location; } - public static final int CONSTRUCTOR = -767091286; + public SetChatLocation(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (ChatLocation.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new ChatLocation(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + } } public static class SetChatMemberStatus extends Function { @@ -21176,8 +51916,9 @@ public class TdApi { public int userId; public ChatMemberStatus status; - public SetChatMemberStatus() { - } + public static final int CONSTRUCTOR = -1754439241; + + public SetChatMemberStatus() {} public SetChatMemberStatus(long chatId, int userId, ChatMemberStatus status) { this.chatId = chatId; @@ -21185,188 +51926,407 @@ public class TdApi { this.status = status; } - public static final int CONSTRUCTOR = -1754439241; + public SetChatMemberStatus(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatMemberStatusCreator.CONSTRUCTOR: + this.status = new ChatMemberStatusCreator(input); + break; + case ChatMemberStatusAdministrator.CONSTRUCTOR: + this.status = new ChatMemberStatusAdministrator(input); + break; + case ChatMemberStatusMember.CONSTRUCTOR: + this.status = new ChatMemberStatusMember(input); + break; + case ChatMemberStatusRestricted.CONSTRUCTOR: + this.status = new ChatMemberStatusRestricted(input); + break; + case ChatMemberStatusLeft.CONSTRUCTOR: + this.status = new ChatMemberStatusLeft(input); + break; + case ChatMemberStatusBanned.CONSTRUCTOR: + this.status = new ChatMemberStatusBanned(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userId); + if (this.status == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.status.serialize(output); + } + } } public static class SetChatNotificationSettings extends Function { public long chatId; public ChatNotificationSettings notificationSettings; - public SetChatNotificationSettings() { - } + public static final int CONSTRUCTOR = 777199614; + + public SetChatNotificationSettings() {} public SetChatNotificationSettings(long chatId, ChatNotificationSettings notificationSettings) { this.chatId = chatId; this.notificationSettings = notificationSettings; } - public static final int CONSTRUCTOR = 777199614; + public SetChatNotificationSettings(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (ChatNotificationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notificationSettings = new ChatNotificationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.notificationSettings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.notificationSettings.serialize(output); + } + } } public static class SetChatPermissions extends Function { public long chatId; public ChatPermissions permissions; - public SetChatPermissions() { - } + public static final int CONSTRUCTOR = 2138507006; + + public SetChatPermissions() {} public SetChatPermissions(long chatId, ChatPermissions permissions) { this.chatId = chatId; this.permissions = permissions; } - public static final int CONSTRUCTOR = 2138507006; + public SetChatPermissions(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + if (ChatPermissions.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.permissions = new ChatPermissions(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.permissions == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.permissions.serialize(output); + } + } } public static class SetChatPhoto extends Function { public long chatId; public InputFile photo; - public SetChatPhoto() { - } + public static final int CONSTRUCTOR = 132244217; + + public SetChatPhoto() {} public SetChatPhoto(long chatId, InputFile photo) { this.chatId = chatId; this.photo = photo; } - public static final int CONSTRUCTOR = 132244217; + public SetChatPhoto(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.photo = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.photo = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.photo = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.photo = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + } } public static class SetChatSlowModeDelay extends Function { public long chatId; public int slowModeDelay; - public SetChatSlowModeDelay() { - } + public static final int CONSTRUCTOR = -540350914; + + public SetChatSlowModeDelay() {} public SetChatSlowModeDelay(long chatId, int slowModeDelay) { this.chatId = chatId; this.slowModeDelay = slowModeDelay; } - public static final int CONSTRUCTOR = -540350914; + public SetChatSlowModeDelay(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.slowModeDelay = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.slowModeDelay); + } } public static class SetChatTitle extends Function { public long chatId; public String title; - public SetChatTitle() { - } + public static final int CONSTRUCTOR = 164282047; + + public SetChatTitle() {} public SetChatTitle(long chatId, String title) { this.chatId = chatId; this.title = title; } - public static final int CONSTRUCTOR = 164282047; + public SetChatTitle(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + if (input.readBoolean()) { + var titleTmp = new byte[input.readInt()]; + input.readFully(titleTmp); + this.title = new String(titleTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + if (this.title == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var titleTmp = this.title.getBytes(StandardCharsets.UTF_8); + output.writeInt(titleTmp.length); + output.write(titleTmp); + } + } } public static class SetCommands extends Function { public BotCommand[] commands; - public SetCommands() { - } + public static final int CONSTRUCTOR = 355010146; + + public SetCommands() {} public SetCommands(BotCommand[] commands) { this.commands = commands; } - public static final int CONSTRUCTOR = 355010146; + public SetCommands(DataInputStream input) throws IOException { + this.commands = new BotCommand[input.readInt()]; + for (int i = 0; i < this.commands.length; i++) { + if (BotCommand.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.commands[i] = new BotCommand(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.commands.length); + for (int i = 0; i < this.commands.length; i++) { + this.commands[i].serialize(output); + } + } } public static class SetCustomLanguagePack extends Function { public LanguagePackInfo info; public LanguagePackString[] strings; - public SetCustomLanguagePack() { - } + public static final int CONSTRUCTOR = -296742819; + + public SetCustomLanguagePack() {} public SetCustomLanguagePack(LanguagePackInfo info, LanguagePackString[] strings) { this.info = info; this.strings = strings; } - public static final int CONSTRUCTOR = -296742819; + public SetCustomLanguagePack(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (LanguagePackInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.info = new LanguagePackInfo(input); + } + this.strings = new LanguagePackString[input.readInt()]; + for (int i = 0; i < this.strings.length; i++) { + if (LanguagePackString.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.strings[i] = new LanguagePackString(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.info == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.info.serialize(output); + } + output.writeInt(this.strings.length); + for (int i = 0; i < this.strings.length; i++) { + this.strings[i].serialize(output); + } + } } public static class SetCustomLanguagePackString extends Function { public String languagePackId; public LanguagePackString newString; - public SetCustomLanguagePackString() { - } + public static final int CONSTRUCTOR = 1316365592; + + public SetCustomLanguagePackString() {} public SetCustomLanguagePackString(String languagePackId, LanguagePackString newString) { this.languagePackId = languagePackId; this.newString = newString; } - public static final int CONSTRUCTOR = 1316365592; + public SetCustomLanguagePackString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + if (LanguagePackString.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.newString = new LanguagePackString(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + if (this.newString == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.newString.serialize(output); + } + } } public static class SetDatabaseEncryptionKey extends Function { public byte[] newEncryptionKey; - public SetDatabaseEncryptionKey() { - } + public static final int CONSTRUCTOR = -1204599371; + + public SetDatabaseEncryptionKey() {} public SetDatabaseEncryptionKey(byte[] newEncryptionKey) { this.newEncryptionKey = newEncryptionKey; } - public static final int CONSTRUCTOR = -1204599371; + public SetDatabaseEncryptionKey(DataInputStream input) throws IOException { + this.newEncryptionKey = new byte[input.readInt()]; + input.readFully(this.newEncryptionKey); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.newEncryptionKey.length); + output.write(this.newEncryptionKey); + } } public static class SetFileGenerationProgress extends Function { @@ -21374,8 +52334,9 @@ public class TdApi { public int expectedSize; public int localPrefixSize; - public SetFileGenerationProgress() { - } + public static final int CONSTRUCTOR = -540459953; + + public SetFileGenerationProgress() {} public SetFileGenerationProgress(long generationId, int expectedSize, int localPrefixSize) { this.generationId = generationId; @@ -21383,12 +52344,22 @@ public class TdApi { this.localPrefixSize = localPrefixSize; } - public static final int CONSTRUCTOR = -540459953; + public SetFileGenerationProgress(DataInputStream input) throws IOException { + this.generationId = input.readLong(); + this.expectedSize = input.readInt(); + this.localPrefixSize = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.generationId); + output.writeInt(this.expectedSize); + output.writeInt(this.localPrefixSize); + } } public static class SetGameScore extends Function { @@ -21399,8 +52370,9 @@ public class TdApi { public int score; public boolean force; - public SetGameScore() { - } + public static final int CONSTRUCTOR = -1768307069; + + public SetGameScore() {} public SetGameScore(long chatId, long messageId, boolean editMessage, int userId, int score, boolean force) { this.chatId = chatId; @@ -21411,12 +52383,28 @@ public class TdApi { this.force = force; } - public static final int CONSTRUCTOR = -1768307069; + public SetGameScore(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.editMessage = input.readBoolean(); + this.userId = input.readInt(); + this.score = input.readInt(); + this.force = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeBoolean(this.editMessage); + output.writeInt(this.userId); + output.writeInt(this.score); + output.writeBoolean(this.force); + } } public static class SetInlineGameScore extends Function { @@ -21426,8 +52414,9 @@ public class TdApi { public int score; public boolean force; - public SetInlineGameScore() { - } + public static final int CONSTRUCTOR = 758435487; + + public SetInlineGameScore() {} public SetInlineGameScore(String inlineMessageId, boolean editMessage, int userId, int score, boolean force) { this.inlineMessageId = inlineMessageId; @@ -21437,184 +52426,471 @@ public class TdApi { this.force = force; } - public static final int CONSTRUCTOR = 758435487; + public SetInlineGameScore(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var inlineMessageIdTmp = new byte[input.readInt()]; + input.readFully(inlineMessageIdTmp); + this.inlineMessageId = new String(inlineMessageIdTmp, StandardCharsets.UTF_8); + } + this.editMessage = input.readBoolean(); + this.userId = input.readInt(); + this.score = input.readInt(); + this.force = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.inlineMessageId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var inlineMessageIdTmp = this.inlineMessageId.getBytes(StandardCharsets.UTF_8); + output.writeInt(inlineMessageIdTmp.length); + output.write(inlineMessageIdTmp); + } + output.writeBoolean(this.editMessage); + output.writeInt(this.userId); + output.writeInt(this.score); + output.writeBoolean(this.force); + } } public static class SetLocation extends Function { public Location location; - public SetLocation() { - } + public static final int CONSTRUCTOR = 93926257; + + public SetLocation() {} public SetLocation(Location location) { this.location = location; } - public static final int CONSTRUCTOR = 93926257; + public SetLocation(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Location.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.location = new Location(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.location == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.location.serialize(output); + } + } } public static class SetLogStream extends Function { public LogStream logStream; - public SetLogStream() { - } + public static final int CONSTRUCTOR = -1364199535; + + public SetLogStream() {} public SetLogStream(LogStream logStream) { this.logStream = logStream; } - public static final int CONSTRUCTOR = -1364199535; + public SetLogStream(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case LogStreamDefault.CONSTRUCTOR: + this.logStream = new LogStreamDefault(input); + break; + case LogStreamFile.CONSTRUCTOR: + this.logStream = new LogStreamFile(input); + break; + case LogStreamEmpty.CONSTRUCTOR: + this.logStream = new LogStreamEmpty(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.logStream == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.logStream.serialize(output); + } + } } public static class SetLogTagVerbosityLevel extends Function { public String tag; public int newVerbosityLevel; - public SetLogTagVerbosityLevel() { - } + public static final int CONSTRUCTOR = -2095589738; + + public SetLogTagVerbosityLevel() {} public SetLogTagVerbosityLevel(String tag, int newVerbosityLevel) { this.tag = tag; this.newVerbosityLevel = newVerbosityLevel; } - public static final int CONSTRUCTOR = -2095589738; + public SetLogTagVerbosityLevel(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var tagTmp = new byte[input.readInt()]; + input.readFully(tagTmp); + this.tag = new String(tagTmp, StandardCharsets.UTF_8); + } + this.newVerbosityLevel = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.tag == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var tagTmp = this.tag.getBytes(StandardCharsets.UTF_8); + output.writeInt(tagTmp.length); + output.write(tagTmp); + } + output.writeInt(this.newVerbosityLevel); + } } public static class SetLogVerbosityLevel extends Function { public int newVerbosityLevel; - public SetLogVerbosityLevel() { - } + public static final int CONSTRUCTOR = -303429678; + + public SetLogVerbosityLevel() {} public SetLogVerbosityLevel(int newVerbosityLevel) { this.newVerbosityLevel = newVerbosityLevel; } - public static final int CONSTRUCTOR = -303429678; + public SetLogVerbosityLevel(DataInputStream input) throws IOException { + this.newVerbosityLevel = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.newVerbosityLevel); + } } public static class SetName extends Function { public String firstName; public String lastName; - public SetName() { - } + public static final int CONSTRUCTOR = 1711693584; + + public SetName() {} public SetName(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } - public static final int CONSTRUCTOR = 1711693584; + public SetName(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var firstNameTmp = new byte[input.readInt()]; + input.readFully(firstNameTmp); + this.firstName = new String(firstNameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var lastNameTmp = new byte[input.readInt()]; + input.readFully(lastNameTmp); + this.lastName = new String(lastNameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.firstName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var firstNameTmp = this.firstName.getBytes(StandardCharsets.UTF_8); + output.writeInt(firstNameTmp.length); + output.write(firstNameTmp); + } + if (this.lastName == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var lastNameTmp = this.lastName.getBytes(StandardCharsets.UTF_8); + output.writeInt(lastNameTmp.length); + output.write(lastNameTmp); + } + } } public static class SetNetworkType extends Function { public NetworkType type; - public SetNetworkType() { - } + public static final int CONSTRUCTOR = -701635234; + + public SetNetworkType() {} public SetNetworkType(NetworkType type) { this.type = type; } - public static final int CONSTRUCTOR = -701635234; + public SetNetworkType(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NetworkTypeNone.CONSTRUCTOR: + this.type = new NetworkTypeNone(input); + break; + case NetworkTypeMobile.CONSTRUCTOR: + this.type = new NetworkTypeMobile(input); + break; + case NetworkTypeMobileRoaming.CONSTRUCTOR: + this.type = new NetworkTypeMobileRoaming(input); + break; + case NetworkTypeWiFi.CONSTRUCTOR: + this.type = new NetworkTypeWiFi(input); + break; + case NetworkTypeOther.CONSTRUCTOR: + this.type = new NetworkTypeOther(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + } } public static class SetOption extends Function { public String name; public OptionValue value; - public SetOption() { - } + public static final int CONSTRUCTOR = 2114670322; + + public SetOption() {} public SetOption(String name, OptionValue value) { this.name = name; this.value = value; } - public static final int CONSTRUCTOR = 2114670322; + public SetOption(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case OptionValueBoolean.CONSTRUCTOR: + this.value = new OptionValueBoolean(input); + break; + case OptionValueEmpty.CONSTRUCTOR: + this.value = new OptionValueEmpty(input); + break; + case OptionValueInteger.CONSTRUCTOR: + this.value = new OptionValueInteger(input); + break; + case OptionValueString.CONSTRUCTOR: + this.value = new OptionValueString(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.value == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.value.serialize(output); + } + } } public static class SetPassportElement extends Function { public InputPassportElement element; public String password; - public SetPassportElement() { - } + public static final int CONSTRUCTOR = 2068173212; + + public SetPassportElement() {} public SetPassportElement(InputPassportElement element, String password) { this.element = element; this.password = password; } - public static final int CONSTRUCTOR = 2068173212; + public SetPassportElement(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputPassportElementPersonalDetails.CONSTRUCTOR: + this.element = new InputPassportElementPersonalDetails(input); + break; + case InputPassportElementPassport.CONSTRUCTOR: + this.element = new InputPassportElementPassport(input); + break; + case InputPassportElementDriverLicense.CONSTRUCTOR: + this.element = new InputPassportElementDriverLicense(input); + break; + case InputPassportElementIdentityCard.CONSTRUCTOR: + this.element = new InputPassportElementIdentityCard(input); + break; + case InputPassportElementInternalPassport.CONSTRUCTOR: + this.element = new InputPassportElementInternalPassport(input); + break; + case InputPassportElementAddress.CONSTRUCTOR: + this.element = new InputPassportElementAddress(input); + break; + case InputPassportElementUtilityBill.CONSTRUCTOR: + this.element = new InputPassportElementUtilityBill(input); + break; + case InputPassportElementBankStatement.CONSTRUCTOR: + this.element = new InputPassportElementBankStatement(input); + break; + case InputPassportElementRentalAgreement.CONSTRUCTOR: + this.element = new InputPassportElementRentalAgreement(input); + break; + case InputPassportElementPassportRegistration.CONSTRUCTOR: + this.element = new InputPassportElementPassportRegistration(input); + break; + case InputPassportElementTemporaryRegistration.CONSTRUCTOR: + this.element = new InputPassportElementTemporaryRegistration(input); + break; + case InputPassportElementPhoneNumber.CONSTRUCTOR: + this.element = new InputPassportElementPhoneNumber(input); + break; + case InputPassportElementEmailAddress.CONSTRUCTOR: + this.element = new InputPassportElementEmailAddress(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.element == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.element.serialize(output); + } + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class SetPassportElementErrors extends Function { public int userId; public InputPassportElementError[] errors; - public SetPassportElementErrors() { - } + public static final int CONSTRUCTOR = 1455869875; + + public SetPassportElementErrors() {} public SetPassportElementErrors(int userId, InputPassportElementError[] errors) { this.userId = userId; this.errors = errors; } - public static final int CONSTRUCTOR = 1455869875; + public SetPassportElementErrors(DataInputStream input) throws IOException { + this.userId = input.readInt(); + this.errors = new InputPassportElementError[input.readInt()]; + for (int i = 0; i < this.errors.length; i++) { + if (InputPassportElementError.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.errors[i] = new InputPassportElementError(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + output.writeInt(this.errors.length); + for (int i = 0; i < this.errors.length; i++) { + this.errors[i].serialize(output); + } + } } public static class SetPassword extends Function { @@ -21624,8 +52900,9 @@ public class TdApi { public boolean setRecoveryEmailAddress; public String newRecoveryEmailAddress; - public SetPassword() { - } + public static final int CONSTRUCTOR = -1193589027; + + public SetPassword() {} public SetPassword(String oldPassword, String newPassword, String newHint, boolean setRecoveryEmailAddress, String newRecoveryEmailAddress) { this.oldPassword = oldPassword; @@ -21635,32 +52912,121 @@ public class TdApi { this.newRecoveryEmailAddress = newRecoveryEmailAddress; } - public static final int CONSTRUCTOR = -1193589027; + public SetPassword(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var oldPasswordTmp = new byte[input.readInt()]; + input.readFully(oldPasswordTmp); + this.oldPassword = new String(oldPasswordTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var newPasswordTmp = new byte[input.readInt()]; + input.readFully(newPasswordTmp); + this.newPassword = new String(newPasswordTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var newHintTmp = new byte[input.readInt()]; + input.readFully(newHintTmp); + this.newHint = new String(newHintTmp, StandardCharsets.UTF_8); + } + this.setRecoveryEmailAddress = input.readBoolean(); + if (input.readBoolean()) { + var newRecoveryEmailAddressTmp = new byte[input.readInt()]; + input.readFully(newRecoveryEmailAddressTmp); + this.newRecoveryEmailAddress = new String(newRecoveryEmailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.oldPassword == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var oldPasswordTmp = this.oldPassword.getBytes(StandardCharsets.UTF_8); + output.writeInt(oldPasswordTmp.length); + output.write(oldPasswordTmp); + } + if (this.newPassword == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newPasswordTmp = this.newPassword.getBytes(StandardCharsets.UTF_8); + output.writeInt(newPasswordTmp.length); + output.write(newPasswordTmp); + } + if (this.newHint == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newHintTmp = this.newHint.getBytes(StandardCharsets.UTF_8); + output.writeInt(newHintTmp.length); + output.write(newHintTmp); + } + output.writeBoolean(this.setRecoveryEmailAddress); + if (this.newRecoveryEmailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newRecoveryEmailAddressTmp = this.newRecoveryEmailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(newRecoveryEmailAddressTmp.length); + output.write(newRecoveryEmailAddressTmp); + } + } } public static class SetPinnedChats extends Function { public ChatList chatList; public long[] chatIds; - public SetPinnedChats() { - } + public static final int CONSTRUCTOR = -695640000; + + public SetPinnedChats() {} public SetPinnedChats(ChatList chatList, long[] chatIds) { this.chatList = chatList; this.chatIds = chatIds; } - public static final int CONSTRUCTOR = -695640000; + public SetPinnedChats(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case ChatListMain.CONSTRUCTOR: + this.chatList = new ChatListMain(input); + break; + case ChatListArchive.CONSTRUCTOR: + this.chatList = new ChatListArchive(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.chatIds = new long[input.readInt()]; + for (int i = 0; i < this.chatIds.length; i++) { + this.chatIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.chatList == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.chatList.serialize(output); + } + output.writeInt(this.chatIds.length); + for (int i = 0; i < this.chatIds.length; i++) { + output.writeLong(this.chatIds[i]); + } + } } public static class SetPollAnswer extends Function { @@ -21668,8 +53034,9 @@ public class TdApi { public long messageId; public int[] optionIds; - public SetPollAnswer() { - } + public static final int CONSTRUCTOR = -1399388792; + + public SetPollAnswer() {} public SetPollAnswer(long chatId, long messageId, int[] optionIds) { this.chatId = chatId; @@ -21677,90 +53044,235 @@ public class TdApi { this.optionIds = optionIds; } - public static final int CONSTRUCTOR = -1399388792; + public SetPollAnswer(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + this.optionIds = new int[input.readInt()]; + for (int i = 0; i < this.optionIds.length; i++) { + this.optionIds[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + output.writeInt(this.optionIds.length); + for (int i = 0; i < this.optionIds.length; i++) { + output.writeInt(this.optionIds[i]); + } + } } public static class SetProfilePhoto extends Function { public InputFile photo; - public SetProfilePhoto() { - } + public static final int CONSTRUCTOR = 1594734550; + + public SetProfilePhoto() {} public SetProfilePhoto(InputFile photo) { this.photo = photo; } - public static final int CONSTRUCTOR = 1594734550; + public SetProfilePhoto(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.photo = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.photo = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.photo = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.photo = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.photo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.photo.serialize(output); + } + } } public static class SetRecoveryEmailAddress extends Function { public String password; public String newRecoveryEmailAddress; - public SetRecoveryEmailAddress() { - } + public static final int CONSTRUCTOR = -1981836385; + + public SetRecoveryEmailAddress() {} public SetRecoveryEmailAddress(String password, String newRecoveryEmailAddress) { this.password = password; this.newRecoveryEmailAddress = newRecoveryEmailAddress; } - public static final int CONSTRUCTOR = -1981836385; + public SetRecoveryEmailAddress(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + var newRecoveryEmailAddressTmp = new byte[input.readInt()]; + input.readFully(newRecoveryEmailAddressTmp); + this.newRecoveryEmailAddress = new String(newRecoveryEmailAddressTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + if (this.newRecoveryEmailAddress == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var newRecoveryEmailAddressTmp = this.newRecoveryEmailAddress.getBytes(StandardCharsets.UTF_8); + output.writeInt(newRecoveryEmailAddressTmp.length); + output.write(newRecoveryEmailAddressTmp); + } + } } public static class SetScopeNotificationSettings extends Function { public NotificationSettingsScope scope; public ScopeNotificationSettings notificationSettings; - public SetScopeNotificationSettings() { - } + public static final int CONSTRUCTOR = -2049984966; + + public SetScopeNotificationSettings() {} public SetScopeNotificationSettings(NotificationSettingsScope scope, ScopeNotificationSettings notificationSettings) { this.scope = scope; this.notificationSettings = notificationSettings; } - public static final int CONSTRUCTOR = -2049984966; + public SetScopeNotificationSettings(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case NotificationSettingsScopePrivateChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopePrivateChats(input); + break; + case NotificationSettingsScopeGroupChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeGroupChats(input); + break; + case NotificationSettingsScopeChannelChats.CONSTRUCTOR: + this.scope = new NotificationSettingsScopeChannelChats(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (ScopeNotificationSettings.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.notificationSettings = new ScopeNotificationSettings(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.scope == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.scope.serialize(output); + } + if (this.notificationSettings == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.notificationSettings.serialize(output); + } + } } public static class SetStickerPositionInSet extends Function { public InputFile sticker; public int position; - public SetStickerPositionInSet() { - } + public static final int CONSTRUCTOR = 2075281185; + + public SetStickerPositionInSet() {} public SetStickerPositionInSet(InputFile sticker, int position) { this.sticker = sticker; this.position = position; } - public static final int CONSTRUCTOR = 2075281185; + public SetStickerPositionInSet(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.sticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.sticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.sticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.sticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.position = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.sticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.sticker.serialize(output); + } + output.writeInt(this.position); + } } public static class SetStickerSetThumbnail extends Function { @@ -21768,8 +53280,9 @@ public class TdApi { public String name; public InputFile thumbnail; - public SetStickerSetThumbnail() { - } + public static final int CONSTRUCTOR = -1694737404; + + public SetStickerSetThumbnail() {} public SetStickerSetThumbnail(int userId, String name, InputFile thumbnail) { this.userId = userId; @@ -21777,126 +53290,293 @@ public class TdApi { this.thumbnail = thumbnail; } - public static final int CONSTRUCTOR = -1694737404; + public SetStickerSetThumbnail(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + var nameTmp = new byte[input.readInt()]; + input.readFully(nameTmp); + this.name = new String(nameTmp, StandardCharsets.UTF_8); + } + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.thumbnail = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.thumbnail = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.thumbnail = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.thumbnail = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.name == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var nameTmp = this.name.getBytes(StandardCharsets.UTF_8); + output.writeInt(nameTmp.length); + output.write(nameTmp); + } + if (this.thumbnail == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.thumbnail.serialize(output); + } + } } public static class SetSupergroupStickerSet extends Function { public int supergroupId; public long stickerSetId; - public SetSupergroupStickerSet() { - } + public static final int CONSTRUCTOR = -295782298; + + public SetSupergroupStickerSet() {} public SetSupergroupStickerSet(int supergroupId, long stickerSetId) { this.supergroupId = supergroupId; this.stickerSetId = stickerSetId; } - public static final int CONSTRUCTOR = -295782298; + public SetSupergroupStickerSet(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + this.stickerSetId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + output.writeLong(this.stickerSetId); + } } public static class SetSupergroupUsername extends Function { public int supergroupId; public String username; - public SetSupergroupUsername() { - } + public static final int CONSTRUCTOR = -1428333122; + + public SetSupergroupUsername() {} public SetSupergroupUsername(int supergroupId, String username) { this.supergroupId = supergroupId; this.username = username; } - public static final int CONSTRUCTOR = -1428333122; + public SetSupergroupUsername(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + } } public static class SetTdlibParameters extends Function { public TdlibParameters parameters; - public SetTdlibParameters() { - } + public static final int CONSTRUCTOR = -1912557997; + + public SetTdlibParameters() {} public SetTdlibParameters(TdlibParameters parameters) { this.parameters = parameters; } - public static final int CONSTRUCTOR = -1912557997; + public SetTdlibParameters(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (TdlibParameters.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.parameters = new TdlibParameters(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.parameters == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.parameters.serialize(output); + } + } } public static class SetUserPrivacySettingRules extends Function { public UserPrivacySetting setting; public UserPrivacySettingRules rules; - public SetUserPrivacySettingRules() { - } + public static final int CONSTRUCTOR = -473812741; + + public SetUserPrivacySettingRules() {} public SetUserPrivacySettingRules(UserPrivacySetting setting, UserPrivacySettingRules rules) { this.setting = setting; this.rules = rules; } - public static final int CONSTRUCTOR = -473812741; + public SetUserPrivacySettingRules(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case UserPrivacySettingShowStatus.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowStatus(input); + break; + case UserPrivacySettingShowProfilePhoto.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowProfilePhoto(input); + break; + case UserPrivacySettingShowLinkInForwardedMessages.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowLinkInForwardedMessages(input); + break; + case UserPrivacySettingShowPhoneNumber.CONSTRUCTOR: + this.setting = new UserPrivacySettingShowPhoneNumber(input); + break; + case UserPrivacySettingAllowChatInvites.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowChatInvites(input); + break; + case UserPrivacySettingAllowCalls.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowCalls(input); + break; + case UserPrivacySettingAllowPeerToPeerCalls.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowPeerToPeerCalls(input); + break; + case UserPrivacySettingAllowFindingByPhoneNumber.CONSTRUCTOR: + this.setting = new UserPrivacySettingAllowFindingByPhoneNumber(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + if (UserPrivacySettingRules.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.rules = new UserPrivacySettingRules(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.setting == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.setting.serialize(output); + } + if (this.rules == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.rules.serialize(output); + } + } } public static class SetUsername extends Function { public String username; - public SetUsername() { - } + public static final int CONSTRUCTOR = 439901214; + + public SetUsername() {} public SetUsername(String username) { this.username = username; } - public static final int CONSTRUCTOR = 439901214; + public SetUsername(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var usernameTmp = new byte[input.readInt()]; + input.readFully(usernameTmp); + this.username = new String(usernameTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.username == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var usernameTmp = this.username.getBytes(StandardCharsets.UTF_8); + output.writeInt(usernameTmp.length); + output.write(usernameTmp); + } + } } public static class SharePhoneNumber extends Function { public int userId; - public SharePhoneNumber() { - } + public static final int CONSTRUCTOR = -370669878; + + public SharePhoneNumber() {} public SharePhoneNumber(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -370669878; + public SharePhoneNumber(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class StopPoll extends Function { @@ -21904,8 +53584,9 @@ public class TdApi { public long messageId; public ReplyMarkup replyMarkup; - public StopPoll() { - } + public static final int CONSTRUCTOR = 1659374253; + + public StopPoll() {} public StopPoll(long chatId, long messageId, ReplyMarkup replyMarkup) { this.chatId = chatId; @@ -21913,208 +53594,374 @@ public class TdApi { this.replyMarkup = replyMarkup; } - public static final int CONSTRUCTOR = 1659374253; + public StopPoll(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ReplyMarkupRemoveKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupRemoveKeyboard(input); + break; + case ReplyMarkupForceReply.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupForceReply(input); + break; + case ReplyMarkupShowKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupShowKeyboard(input); + break; + case ReplyMarkupInlineKeyboard.CONSTRUCTOR: + this.replyMarkup = new ReplyMarkupInlineKeyboard(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.replyMarkup == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.replyMarkup.serialize(output); + } + } } public static class SynchronizeLanguagePack extends Function { public String languagePackId; - public SynchronizeLanguagePack() { - } + public static final int CONSTRUCTOR = -2065307858; + + public SynchronizeLanguagePack() {} public SynchronizeLanguagePack(String languagePackId) { this.languagePackId = languagePackId; } - public static final int CONSTRUCTOR = -2065307858; + public SynchronizeLanguagePack(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var languagePackIdTmp = new byte[input.readInt()]; + input.readFully(languagePackIdTmp); + this.languagePackId = new String(languagePackIdTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.languagePackId == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var languagePackIdTmp = this.languagePackId.getBytes(StandardCharsets.UTF_8); + output.writeInt(languagePackIdTmp.length); + output.write(languagePackIdTmp); + } + } } public static class TerminateAllOtherSessions extends Function { - - public TerminateAllOtherSessions() { - } - public static final int CONSTRUCTOR = 1874485523; - @Override + public TerminateAllOtherSessions() {} + + + public TerminateAllOtherSessions(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TerminateSession extends Function { public long sessionId; - public TerminateSession() { - } + public static final int CONSTRUCTOR = -407385812; + + public TerminateSession() {} public TerminateSession(long sessionId) { this.sessionId = sessionId; } - public static final int CONSTRUCTOR = -407385812; + public TerminateSession(DataInputStream input) throws IOException { + this.sessionId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.sessionId); + } } public static class TestCallBytes extends Function { public byte[] x; - public TestCallBytes() { - } + public static final int CONSTRUCTOR = -736011607; + + public TestCallBytes() {} public TestCallBytes(byte[] x) { this.x = x; } - public static final int CONSTRUCTOR = -736011607; + public TestCallBytes(DataInputStream input) throws IOException { + this.x = new byte[input.readInt()]; + input.readFully(this.x); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.x.length); + output.write(this.x); + } } public static class TestCallEmpty extends Function { - - public TestCallEmpty() { - } - public static final int CONSTRUCTOR = -627291626; - @Override + public TestCallEmpty() {} + + + public TestCallEmpty(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TestCallString extends Function { public String x; - public TestCallString() { - } + public static final int CONSTRUCTOR = -1732818385; + + public TestCallString() {} public TestCallString(String x) { this.x = x; } - public static final int CONSTRUCTOR = -1732818385; + public TestCallString(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var xTmp = new byte[input.readInt()]; + input.readFully(xTmp); + this.x = new String(xTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.x == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var xTmp = this.x.getBytes(StandardCharsets.UTF_8); + output.writeInt(xTmp.length); + output.write(xTmp); + } + } } public static class TestCallVectorInt extends Function { public int[] x; - public TestCallVectorInt() { - } + public static final int CONSTRUCTOR = -2137277793; + + public TestCallVectorInt() {} public TestCallVectorInt(int[] x) { this.x = x; } - public static final int CONSTRUCTOR = -2137277793; + public TestCallVectorInt(DataInputStream input) throws IOException { + this.x = new int[input.readInt()]; + for (int i = 0; i < this.x.length; i++) { + this.x[i] = input.readInt(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.x.length); + for (int i = 0; i < this.x.length; i++) { + output.writeInt(this.x[i]); + } + } } public static class TestCallVectorIntObject extends Function { public TestInt[] x; - public TestCallVectorIntObject() { - } + public static final int CONSTRUCTOR = 1825428218; + + public TestCallVectorIntObject() {} public TestCallVectorIntObject(TestInt[] x) { this.x = x; } - public static final int CONSTRUCTOR = 1825428218; + public TestCallVectorIntObject(DataInputStream input) throws IOException { + this.x = new TestInt[input.readInt()]; + for (int i = 0; i < this.x.length; i++) { + if (TestInt.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.x[i] = new TestInt(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.x.length); + for (int i = 0; i < this.x.length; i++) { + this.x[i].serialize(output); + } + } } public static class TestCallVectorString extends Function { public String[] x; - public TestCallVectorString() { - } + public static final int CONSTRUCTOR = -408600900; + + public TestCallVectorString() {} public TestCallVectorString(String[] x) { this.x = x; } - public static final int CONSTRUCTOR = -408600900; + public TestCallVectorString(DataInputStream input) throws IOException { + this.x = new String[input.readInt()]; + for (int i = 0; i < this.x.length; i++) { + var xTmp = new byte[input.readInt()]; + input.readFully(xTmp); + this.x[i] = new String(xTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.x.length); + for (int i = 0; i < this.x.length; i++) { + var xTmp = this.x[i].getBytes(StandardCharsets.UTF_8); + output.writeInt(xTmp.length); + output.write(xTmp); + } + } } public static class TestCallVectorStringObject extends Function { public TestString[] x; - public TestCallVectorStringObject() { - } + public static final int CONSTRUCTOR = 1527666429; + + public TestCallVectorStringObject() {} public TestCallVectorStringObject(TestString[] x) { this.x = x; } - public static final int CONSTRUCTOR = 1527666429; + public TestCallVectorStringObject(DataInputStream input) throws IOException { + this.x = new TestString[input.readInt()]; + for (int i = 0; i < this.x.length; i++) { + if (TestString.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.x[i] = new TestString(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.x.length); + for (int i = 0; i < this.x.length; i++) { + this.x[i].serialize(output); + } + } } public static class TestGetDifference extends Function { - - public TestGetDifference() { - } - public static final int CONSTRUCTOR = 1747084069; - @Override + public TestGetDifference() {} + + + public TestGetDifference(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TestNetwork extends Function { - - public TestNetwork() { - } - public static final int CONSTRUCTOR = -1343998901; - @Override + public TestNetwork() {} + + + public TestNetwork(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class TestProxy extends Function { @@ -22124,8 +53971,9 @@ public class TdApi { public int dcId; public double timeout; - public TestProxy() { - } + public static final int CONSTRUCTOR = -1197366626; + + public TestProxy() {} public TestProxy(String server, int port, ProxyType type, int dcId, double timeout) { this.server = server; @@ -22135,161 +53983,279 @@ public class TdApi { this.timeout = timeout; } - public static final int CONSTRUCTOR = -1197366626; + public TestProxy(DataInputStream input) throws IOException { + if (input.readBoolean()) { + var serverTmp = new byte[input.readInt()]; + input.readFully(serverTmp); + this.server = new String(serverTmp, StandardCharsets.UTF_8); + } + this.port = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case ProxyTypeSocks5.CONSTRUCTOR: + this.type = new ProxyTypeSocks5(input); + break; + case ProxyTypeHttp.CONSTRUCTOR: + this.type = new ProxyTypeHttp(input); + break; + case ProxyTypeMtproto.CONSTRUCTOR: + this.type = new ProxyTypeMtproto(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.dcId = input.readInt(); + this.timeout = input.readDouble(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.server == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var serverTmp = this.server.getBytes(StandardCharsets.UTF_8); + output.writeInt(serverTmp.length); + output.write(serverTmp); + } + output.writeInt(this.port); + if (this.type == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.type.serialize(output); + } + output.writeInt(this.dcId); + output.writeDouble(this.timeout); + } } public static class TestReturnError extends Function { public Error error; - public TestReturnError() { - } + public static final int CONSTRUCTOR = 455179506; + + public TestReturnError() {} public TestReturnError(Error error) { this.error = error; } - public static final int CONSTRUCTOR = 455179506; + public TestReturnError(DataInputStream input) throws IOException { + if (input.readBoolean()) { + if (Error.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.error = new Error(input); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.error == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.error.serialize(output); + } + } } public static class TestSquareInt extends Function { public int x; - public TestSquareInt() { - } + public static final int CONSTRUCTOR = -60135024; + + public TestSquareInt() {} public TestSquareInt(int x) { this.x = x; } - public static final int CONSTRUCTOR = -60135024; + public TestSquareInt(DataInputStream input) throws IOException { + this.x = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.x); + } } public static class TestUseUpdate extends Function { - - public TestUseUpdate() { - } - public static final int CONSTRUCTOR = 717094686; - @Override + public TestUseUpdate() {} + + + public TestUseUpdate(DataInputStream input) throws IOException { + } + public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + } } public static class ToggleChatDefaultDisableNotification extends Function { public long chatId; public boolean defaultDisableNotification; - public ToggleChatDefaultDisableNotification() { - } + public static final int CONSTRUCTOR = 314794002; + + public ToggleChatDefaultDisableNotification() {} public ToggleChatDefaultDisableNotification(long chatId, boolean defaultDisableNotification) { this.chatId = chatId; this.defaultDisableNotification = defaultDisableNotification; } - public static final int CONSTRUCTOR = 314794002; + public ToggleChatDefaultDisableNotification(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.defaultDisableNotification = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.defaultDisableNotification); + } } public static class ToggleChatIsMarkedAsUnread extends Function { public long chatId; public boolean isMarkedAsUnread; - public ToggleChatIsMarkedAsUnread() { - } + public static final int CONSTRUCTOR = -986129697; + + public ToggleChatIsMarkedAsUnread() {} public ToggleChatIsMarkedAsUnread(long chatId, boolean isMarkedAsUnread) { this.chatId = chatId; this.isMarkedAsUnread = isMarkedAsUnread; } - public static final int CONSTRUCTOR = -986129697; + public ToggleChatIsMarkedAsUnread(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.isMarkedAsUnread = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.isMarkedAsUnread); + } } public static class ToggleChatIsPinned extends Function { public long chatId; public boolean isPinned; - public ToggleChatIsPinned() { - } + public static final int CONSTRUCTOR = -1166802621; + + public ToggleChatIsPinned() {} public ToggleChatIsPinned(long chatId, boolean isPinned) { this.chatId = chatId; this.isPinned = isPinned; } - public static final int CONSTRUCTOR = -1166802621; + public ToggleChatIsPinned(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.isPinned = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeBoolean(this.isPinned); + } } public static class ToggleSupergroupIsAllHistoryAvailable extends Function { public int supergroupId; public boolean isAllHistoryAvailable; - public ToggleSupergroupIsAllHistoryAvailable() { - } + public static final int CONSTRUCTOR = 1701526555; + + public ToggleSupergroupIsAllHistoryAvailable() {} public ToggleSupergroupIsAllHistoryAvailable(int supergroupId, boolean isAllHistoryAvailable) { this.supergroupId = supergroupId; this.isAllHistoryAvailable = isAllHistoryAvailable; } - public static final int CONSTRUCTOR = 1701526555; + public ToggleSupergroupIsAllHistoryAvailable(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + this.isAllHistoryAvailable = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + output.writeBoolean(this.isAllHistoryAvailable); + } } public static class ToggleSupergroupSignMessages extends Function { public int supergroupId; public boolean signMessages; - public ToggleSupergroupSignMessages() { - } + public static final int CONSTRUCTOR = -558196581; + + public ToggleSupergroupSignMessages() {} public ToggleSupergroupSignMessages(int supergroupId, boolean signMessages) { this.supergroupId = supergroupId; this.signMessages = signMessages; } - public static final int CONSTRUCTOR = -558196581; + public ToggleSupergroupSignMessages(DataInputStream input) throws IOException { + this.supergroupId = input.readInt(); + this.signMessages = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.supergroupId); + output.writeBoolean(this.signMessages); + } } public static class TransferChatOwnership extends Function { @@ -22297,8 +54263,9 @@ public class TdApi { public int userId; public String password; - public TransferChatOwnership() { - } + public static final int CONSTRUCTOR = -1925047127; + + public TransferChatOwnership() {} public TransferChatOwnership(long chatId, int userId, String password) { this.chatId = chatId; @@ -22306,66 +54273,108 @@ public class TdApi { this.password = password; } - public static final int CONSTRUCTOR = -1925047127; + public TransferChatOwnership(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.userId = input.readInt(); + if (input.readBoolean()) { + var passwordTmp = new byte[input.readInt()]; + input.readFully(passwordTmp); + this.password = new String(passwordTmp, StandardCharsets.UTF_8); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.userId); + if (this.password == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + var passwordTmp = this.password.getBytes(StandardCharsets.UTF_8); + output.writeInt(passwordTmp.length); + output.write(passwordTmp); + } + } } public static class UnblockUser extends Function { public int userId; - public UnblockUser() { - } + public static final int CONSTRUCTOR = -307286367; + + public UnblockUser() {} public UnblockUser(int userId) { this.userId = userId; } - public static final int CONSTRUCTOR = -307286367; + public UnblockUser(DataInputStream input) throws IOException { + this.userId = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + } } public static class UnpinChatMessage extends Function { public long chatId; - public UnpinChatMessage() { - } + public static final int CONSTRUCTOR = 277557690; + + public UnpinChatMessage() {} public UnpinChatMessage(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 277557690; + public UnpinChatMessage(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class UpgradeBasicGroupChatToSupergroupChat extends Function { public long chatId; - public UpgradeBasicGroupChatToSupergroupChat() { - } + public static final int CONSTRUCTOR = 300488122; + + public UpgradeBasicGroupChatToSupergroupChat() {} public UpgradeBasicGroupChatToSupergroupChat(long chatId) { this.chatId = chatId; } - public static final int CONSTRUCTOR = 300488122; + public UpgradeBasicGroupChatToSupergroupChat(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + } } public static class UploadFile extends Function { @@ -22373,8 +54382,9 @@ public class TdApi { public FileType fileType; public int priority; - public UploadFile() { - } + public static final int CONSTRUCTOR = -745597786; + + public UploadFile() {} public UploadFile(InputFile file, FileType fileType, int priority) { this.file = file; @@ -22382,32 +54392,153 @@ public class TdApi { this.priority = priority; } - public static final int CONSTRUCTOR = -745597786; + public UploadFile(DataInputStream input) throws IOException { + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.file = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.file = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.file = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.file = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + if (input.readBoolean()) { + switch(input.readInt()) { + case FileTypeNone.CONSTRUCTOR: + this.fileType = new FileTypeNone(input); + break; + case FileTypeAnimation.CONSTRUCTOR: + this.fileType = new FileTypeAnimation(input); + break; + case FileTypeAudio.CONSTRUCTOR: + this.fileType = new FileTypeAudio(input); + break; + case FileTypeDocument.CONSTRUCTOR: + this.fileType = new FileTypeDocument(input); + break; + case FileTypePhoto.CONSTRUCTOR: + this.fileType = new FileTypePhoto(input); + break; + case FileTypeProfilePhoto.CONSTRUCTOR: + this.fileType = new FileTypeProfilePhoto(input); + break; + case FileTypeSecret.CONSTRUCTOR: + this.fileType = new FileTypeSecret(input); + break; + case FileTypeSecretThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeSecretThumbnail(input); + break; + case FileTypeSecure.CONSTRUCTOR: + this.fileType = new FileTypeSecure(input); + break; + case FileTypeSticker.CONSTRUCTOR: + this.fileType = new FileTypeSticker(input); + break; + case FileTypeThumbnail.CONSTRUCTOR: + this.fileType = new FileTypeThumbnail(input); + break; + case FileTypeUnknown.CONSTRUCTOR: + this.fileType = new FileTypeUnknown(input); + break; + case FileTypeVideo.CONSTRUCTOR: + this.fileType = new FileTypeVideo(input); + break; + case FileTypeVideoNote.CONSTRUCTOR: + this.fileType = new FileTypeVideoNote(input); + break; + case FileTypeVoiceNote.CONSTRUCTOR: + this.fileType = new FileTypeVoiceNote(input); + break; + case FileTypeWallpaper.CONSTRUCTOR: + this.fileType = new FileTypeWallpaper(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + this.priority = input.readInt(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + if (this.file == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.file.serialize(output); + } + if (this.fileType == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.fileType.serialize(output); + } + output.writeInt(this.priority); + } } public static class UploadStickerFile extends Function { public int userId; public InputFile pngSticker; - public UploadStickerFile() { - } + public static final int CONSTRUCTOR = 1134087551; + + public UploadStickerFile() {} public UploadStickerFile(int userId, InputFile pngSticker) { this.userId = userId; this.pngSticker = pngSticker; } - public static final int CONSTRUCTOR = 1134087551; + public UploadStickerFile(DataInputStream input) throws IOException { + this.userId = input.readInt(); + if (input.readBoolean()) { + switch(input.readInt()) { + case InputFileId.CONSTRUCTOR: + this.pngSticker = new InputFileId(input); + break; + case InputFileRemote.CONSTRUCTOR: + this.pngSticker = new InputFileRemote(input); + break; + case InputFileLocal.CONSTRUCTOR: + this.pngSticker = new InputFileLocal(input); + break; + case InputFileGenerated.CONSTRUCTOR: + this.pngSticker = new InputFileGenerated(input); + break; + default: + throw new UnsupportedOperationException(); + } + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.userId); + if (this.pngSticker == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.pngSticker.serialize(output); + } + } } public static class ValidateOrderInfo extends Function { @@ -22416,8 +54547,9 @@ public class TdApi { public OrderInfo orderInfo; public boolean allowSave; - public ValidateOrderInfo() { - } + public static final int CONSTRUCTOR = 9480644; + + public ValidateOrderInfo() {} public ValidateOrderInfo(long chatId, long messageId, OrderInfo orderInfo, boolean allowSave) { this.chatId = chatId; @@ -22426,12 +54558,34 @@ public class TdApi { this.allowSave = allowSave; } - public static final int CONSTRUCTOR = 9480644; + public ValidateOrderInfo(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageId = input.readLong(); + if (input.readBoolean()) { + if (OrderInfo.CONSTRUCTOR != input.readInt()) { + throw new UnsupportedOperationException(); + } + this.orderInfo = new OrderInfo(input); + } + this.allowSave = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeLong(this.messageId); + if (this.orderInfo == null) { + output.writeBoolean(false); + } else { + output.writeBoolean(true); + this.orderInfo.serialize(output); + } + output.writeBoolean(this.allowSave); + } } public static class ViewMessages extends Function { @@ -22439,8 +54593,9 @@ public class TdApi { public long[] messageIds; public boolean forceRead; - public ViewMessages() { - } + public static final int CONSTRUCTOR = -1925784915; + + public ViewMessages() {} public ViewMessages(long chatId, long[] messageIds, boolean forceRead) { this.chatId = chatId; @@ -22448,30 +54603,59 @@ public class TdApi { this.forceRead = forceRead; } - public static final int CONSTRUCTOR = -1925784915; + public ViewMessages(DataInputStream input) throws IOException { + this.chatId = input.readLong(); + this.messageIds = new long[input.readInt()]; + for (int i = 0; i < this.messageIds.length; i++) { + this.messageIds[i] = input.readLong(); + } + this.forceRead = input.readBoolean(); + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.chatId); + output.writeInt(this.messageIds.length); + for (int i = 0; i < this.messageIds.length; i++) { + output.writeLong(this.messageIds[i]); + } + output.writeBoolean(this.forceRead); + } } public static class ViewTrendingStickerSets extends Function { public long[] stickerSetIds; - public ViewTrendingStickerSets() { - } + public static final int CONSTRUCTOR = -952416520; + + public ViewTrendingStickerSets() {} public ViewTrendingStickerSets(long[] stickerSetIds) { this.stickerSetIds = stickerSetIds; } - public static final int CONSTRUCTOR = -952416520; + public ViewTrendingStickerSets(DataInputStream input) throws IOException { + this.stickerSetIds = new long[input.readInt()]; + for (int i = 0; i < this.stickerSetIds.length; i++) { + this.stickerSetIds[i] = input.readLong(); + } + } - @Override public int getConstructor() { return CONSTRUCTOR; } + + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeInt(this.stickerSetIds.length); + for (int i = 0; i < this.stickerSetIds.length; i++) { + output.writeLong(this.stickerSetIds[i]); + } + } } public static class WriteGeneratedFilePart extends Function { @@ -22479,8 +54663,9 @@ public class TdApi { public int offset; public byte[] data; - public WriteGeneratedFilePart() { - } + public static final int CONSTRUCTOR = -2062358189; + + public WriteGeneratedFilePart() {} public WriteGeneratedFilePart(long generationId, int offset, byte[] data) { this.generationId = generationId; @@ -22488,12 +54673,23 @@ public class TdApi { this.data = data; } - public static final int CONSTRUCTOR = -2062358189; + public WriteGeneratedFilePart(DataInputStream input) throws IOException { + this.generationId = input.readLong(); + this.offset = input.readInt(); + this.data = new byte[input.readInt()]; + input.readFully(this.data); + } - @Override public int getConstructor() { return CONSTRUCTOR; } - } -} + public void serialize(DataOutputStream output) throws IOException { + output.writeInt(this.CONSTRUCTOR); + output.writeLong(this.generationId); + output.writeInt(this.offset); + output.writeInt(this.data.length); + output.write(this.data); + } + } +} \ No newline at end of file