diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index c095be68a0..d31b2b8a51 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// Layer: 174 -// SHA256: 0ddea0bde6ac2c064737f407b043fa0ef68eb8d7710f92f8c7e758af19ca65bf +// Layer: 176 +// SHA256: e447f36c77d29528496ba50bba150f93d90641232d01fbb0fe1d55ddf1eb29f7 boolFalse#bc799737 = Bool; @@ -186,7 +186,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#1e4c8a69 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; +message#a66c7efc flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -380,7 +380,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#22ff3e85 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -704,6 +704,18 @@ updatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector = Upd updateSavedReactionTags#39c67432 = Update; +updateSmsJob#f16269d4 job_id:string = Update; + +updateQuickReplies#f9470ab2 quick_replies:Vector = Update; + +updateNewQuickReply#f53da717 quick_reply:QuickReply = Update; + +updateDeleteQuickReply#53e6f1ec shortcut_id:int = Update; + +updateQuickReplyMessage#3e050d0f message:Message = Update; + +updateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -1916,11 +1928,11 @@ bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; payments.bankCardData#3e24e573 title:string open_urls:Vector = payments.BankCardData; -dialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; +dialogFilter#5fb5523b flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; dialogFilterDefault#363293ae = DialogFilter; -dialogFilterChatlist#d64a04a8 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string pinned_peers:Vector include_peers:Vector = DialogFilter; +dialogFilterChatlist#9fe28ea4 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector = DialogFilter; dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested; @@ -2430,6 +2442,58 @@ messages.savedReactionTags#3259950a tags:Vector hash:long = me outboxReadDate#3bb842ac date:int = OutboxReadDate; +smsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin; + +smsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status; + +smsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob; + +businessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen; + +businessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector = BusinessWorkHours; + +businessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation; + +inputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = InputBusinessRecipients; + +businessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = BusinessRecipients; + +businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; + +businessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule; + +businessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule; + +inputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage; + +businessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage; + +inputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage; + +businessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage; + +timezone#ff9289f5 id:string name:string utc_offset:int = Timezone; + +help.timezonesListNotModified#970708cc = help.TimezonesList; + +help.timezonesList#7b74ed71 timezones:Vector hash:int = help.TimezonesList; + +quickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply; + +inputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut; + +inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut; + +messages.quickReplies#c68d6695 quick_replies:Vector messages:Vector chats:Vector users:Vector = messages.QuickReplies; + +messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies; + +connectedBot#e7e999e7 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessRecipients = ConnectedBot; + +account.connectedBots#17d7f87b connected_bots:Vector users:Vector = account.ConnectedBots; + +messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector = messages.DialogFilters; + ---functions--- @@ -2675,6 +2739,18 @@ account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuse account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; +account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?BusinessWorkHours = Bool; + +account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool; + +account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool; + +account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool; + +account.updateConnectedBot#9c2d527d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessRecipients = Updates; + +account.getConnectedBots#4ea4c80f = account.ConnectedBots; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -2751,11 +2827,11 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#280d096f flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMessage#dff8042c flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.sendMedia#72ccc23d flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMedia#7bd66041 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.forwardMessages#c661bbc4 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -2841,11 +2917,11 @@ messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_p messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; -messages.sendInlineBotResult#f7bc68ba flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; -messages.editMessage#48f71778 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int = Updates; +messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates; messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; @@ -2911,7 +2987,7 @@ messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = m messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#456e8987 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMultiMedia#c964709 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; @@ -2965,7 +3041,7 @@ messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?byte messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector = Bool; -messages.getDialogFilters#f19ed96d = Vector; +messages.getDialogFilters#efd48c89 = messages.DialogFilters; messages.getSuggestedDialogFilters#a29cd42c = Vector; @@ -3129,6 +3205,24 @@ messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; +messages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies; + +messages.reorderQuickReplies#60331907 order:Vector = Bool; + +messages.checkQuickReplyShortcut#f1d0fbd3 shortcut:string = Bool; + +messages.editQuickReplyShortcut#5c003cef shortcut_id:int shortcut:string = Bool; + +messages.deleteQuickReplyShortcut#3cc04740 shortcut_id:int = Bool; + +messages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector hash:long = messages.Messages; + +messages.sendQuickReplyMessages#33153ad4 peer:InputPeer shortcut_id:int = Updates; + +messages.deleteQuickReplyMessages#e105e910 shortcut_id:int id:Vector = Updates; + +messages.toggleDialogFilterTags#fd2dda49 enabled:Bool = Bool; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3209,6 +3303,8 @@ help.getPeerColors#da80f42f hash:int = help.PeerColors; help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; +help.getTimezonesList#49b30240 hash:int = help.TimezonesList; + channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -3585,4 +3681,18 @@ premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -// LAYER 174 +smsjobs.isEligibleToJoin#edc39d0 = smsjobs.EligibilityToJoin; + +smsjobs.join#a74ece2d = Bool; + +smsjobs.leave#9898ad73 = Bool; + +smsjobs.updateSettings#93fa0bf flags:# allow_international:flags.0?true = Bool; + +smsjobs.getStatus#10a698e8 = smsjobs.Status; + +smsjobs.getSmsJob#778d902f job_id:string = SmsJob; + +smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; + +// LAYER 176 diff --git a/_schema/tdlib.tl b/_schema/tdlib.tl index cfd57a51f5..efdf6c6c88 100644 --- a/_schema/tdlib.tl +++ b/_schema/tdlib.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/telegram_api.tl -// Layer: 174 -// SHA256: 7b99cefb18807ba462b8bff462dd4c909ee8b5510d41df1c489a1aa47a395327 +// Layer: 176 +// SHA256: 3bd9b1150ff7a709de2e1e161a1ed8484b68f4c21a3b5a2dc021c5f85a246e5f int#a8509bda ? = Int; @@ -218,7 +218,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#1e4c8a69 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; +message#a66c7efc flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -412,7 +412,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#22ff3e85 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -736,6 +736,18 @@ updatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector = Upd updateSavedReactionTags#39c67432 = Update; +updateSmsJob#f16269d4 job_id:string = Update; + +updateQuickReplies#f9470ab2 quick_replies:Vector = Update; + +updateNewQuickReply#f53da717 quick_reply:QuickReply = Update; + +updateDeleteQuickReply#53e6f1ec shortcut_id:int = Update; + +updateQuickReplyMessage#3e050d0f message:Message = Update; + +updateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -1948,11 +1960,11 @@ bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; payments.bankCardData#3e24e573 title:string open_urls:Vector = payments.BankCardData; -dialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; +dialogFilter#5fb5523b flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; dialogFilterDefault#363293ae = DialogFilter; -dialogFilterChatlist#d64a04a8 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string pinned_peers:Vector include_peers:Vector = DialogFilter; +dialogFilterChatlist#9fe28ea4 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector = DialogFilter; dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested; @@ -2462,6 +2474,58 @@ messages.savedReactionTags#3259950a tags:Vector hash:long = me outboxReadDate#3bb842ac date:int = OutboxReadDate; +smsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin; + +smsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status; + +smsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob; + +businessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen; + +businessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector = BusinessWorkHours; + +businessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation; + +inputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = InputBusinessRecipients; + +businessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = BusinessRecipients; + +businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; + +businessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule; + +businessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule; + +inputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage; + +businessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage; + +inputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage; + +businessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage; + +timezone#ff9289f5 id:string name:string utc_offset:int = Timezone; + +help.timezonesListNotModified#970708cc = help.TimezonesList; + +help.timezonesList#7b74ed71 timezones:Vector hash:int = help.TimezonesList; + +quickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply; + +inputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut; + +inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut; + +messages.quickReplies#c68d6695 quick_replies:Vector messages:Vector chats:Vector users:Vector = messages.QuickReplies; + +messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies; + +connectedBot#e7e999e7 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessRecipients = ConnectedBot; + +account.connectedBots#17d7f87b connected_bots:Vector users:Vector = account.ConnectedBots; + +messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector = messages.DialogFilters; + ---functions--- @@ -2707,6 +2771,18 @@ account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuse account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; +account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?BusinessWorkHours = Bool; + +account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool; + +account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool; + +account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool; + +account.updateConnectedBot#9c2d527d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessRecipients = Updates; + +account.getConnectedBots#4ea4c80f = account.ConnectedBots; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -2783,11 +2859,11 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#280d096f flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMessage#dff8042c flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.sendMedia#72ccc23d flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMedia#7bd66041 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.forwardMessages#c661bbc4 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -2873,11 +2949,11 @@ messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_p messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; -messages.sendInlineBotResult#f7bc68ba flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; -messages.editMessage#48f71778 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int = Updates; +messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates; messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; @@ -2943,7 +3019,7 @@ messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = m messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#456e8987 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMultiMedia#c964709 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; @@ -2997,7 +3073,7 @@ messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?byte messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector = Bool; -messages.getDialogFilters#f19ed96d = Vector; +messages.getDialogFilters#efd48c89 = messages.DialogFilters; messages.getSuggestedDialogFilters#a29cd42c = Vector; @@ -3161,6 +3237,24 @@ messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; +messages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies; + +messages.reorderQuickReplies#60331907 order:Vector = Bool; + +messages.checkQuickReplyShortcut#f1d0fbd3 shortcut:string = Bool; + +messages.editQuickReplyShortcut#5c003cef shortcut_id:int shortcut:string = Bool; + +messages.deleteQuickReplyShortcut#3cc04740 shortcut_id:int = Bool; + +messages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector hash:long = messages.Messages; + +messages.sendQuickReplyMessages#33153ad4 peer:InputPeer shortcut_id:int = Updates; + +messages.deleteQuickReplyMessages#e105e910 shortcut_id:int id:Vector = Updates; + +messages.toggleDialogFilterTags#fd2dda49 enabled:Bool = Bool; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3241,6 +3335,8 @@ help.getPeerColors#da80f42f hash:int = help.PeerColors; help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; +help.getTimezonesList#49b30240 hash:int = help.TimezonesList; + channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -3617,4 +3713,18 @@ premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -// LAYER 174 +smsjobs.isEligibleToJoin#edc39d0 = smsjobs.EligibilityToJoin; + +smsjobs.join#a74ece2d = Bool; + +smsjobs.leave#9898ad73 = Bool; + +smsjobs.updateSettings#93fa0bf flags:# allow_international:flags.0?true = Bool; + +smsjobs.getStatus#10a698e8 = smsjobs.Status; + +smsjobs.getSmsJob#778d902f job_id:string = SmsJob; + +smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; + +// LAYER 176 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 66cd13da6d..4f9d3c5893 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl // Merge: _schema/legacy.tl -// Layer: 174 -// SHA256: 0ddea0bde6ac2c064737f407b043fa0ef68eb8d7710f92f8c7e758af19ca65bf +// Layer: 176 +// SHA256: e447f36c77d29528496ba50bba150f93d90641232d01fbb0fe1d55ddf1eb29f7 boolFalse#bc799737 = Bool; @@ -187,7 +187,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#1e4c8a69 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; +message#a66c7efc flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -381,7 +381,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#22ff3e85 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -705,6 +705,18 @@ updatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector = Upd updateSavedReactionTags#39c67432 = Update; +updateSmsJob#f16269d4 job_id:string = Update; + +updateQuickReplies#f9470ab2 quick_replies:Vector = Update; + +updateNewQuickReply#f53da717 quick_reply:QuickReply = Update; + +updateDeleteQuickReply#53e6f1ec shortcut_id:int = Update; + +updateQuickReplyMessage#3e050d0f message:Message = Update; + +updateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -1917,11 +1929,11 @@ bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; payments.bankCardData#3e24e573 title:string open_urls:Vector = payments.BankCardData; -dialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; +dialogFilter#5fb5523b flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; dialogFilterDefault#363293ae = DialogFilter; -dialogFilterChatlist#d64a04a8 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string pinned_peers:Vector include_peers:Vector = DialogFilter; +dialogFilterChatlist#9fe28ea4 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector = DialogFilter; dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested; @@ -2431,6 +2443,58 @@ messages.savedReactionTags#3259950a tags:Vector hash:long = me outboxReadDate#3bb842ac date:int = OutboxReadDate; +smsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin; + +smsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status; + +smsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob; + +businessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen; + +businessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector = BusinessWorkHours; + +businessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation; + +inputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = InputBusinessRecipients; + +businessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = BusinessRecipients; + +businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; + +businessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule; + +businessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule; + +inputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage; + +businessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage; + +inputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage; + +businessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage; + +timezone#ff9289f5 id:string name:string utc_offset:int = Timezone; + +help.timezonesListNotModified#970708cc = help.TimezonesList; + +help.timezonesList#7b74ed71 timezones:Vector hash:int = help.TimezonesList; + +quickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply; + +inputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut; + +inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut; + +messages.quickReplies#c68d6695 quick_replies:Vector messages:Vector chats:Vector users:Vector = messages.QuickReplies; + +messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies; + +connectedBot#e7e999e7 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessRecipients = ConnectedBot; + +account.connectedBots#17d7f87b connected_bots:Vector users:Vector = account.ConnectedBots; + +messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector = messages.DialogFilters; + ---functions--- @@ -2676,6 +2740,18 @@ account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuse account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; +account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?BusinessWorkHours = Bool; + +account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool; + +account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool; + +account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool; + +account.updateConnectedBot#9c2d527d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessRecipients = Updates; + +account.getConnectedBots#4ea4c80f = account.ConnectedBots; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -2752,11 +2828,11 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#280d096f flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMessage#dff8042c flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.sendMedia#72ccc23d flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMedia#7bd66041 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.forwardMessages#c661bbc4 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -2842,11 +2918,11 @@ messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_p messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; -messages.sendInlineBotResult#f7bc68ba flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; -messages.editMessage#48f71778 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int = Updates; +messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates; messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; @@ -2912,7 +2988,7 @@ messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = m messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#456e8987 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMultiMedia#c964709 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; @@ -2966,7 +3042,7 @@ messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?byte messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector = Bool; -messages.getDialogFilters#f19ed96d = Vector; +messages.getDialogFilters#efd48c89 = messages.DialogFilters; messages.getSuggestedDialogFilters#a29cd42c = Vector; @@ -3130,6 +3206,24 @@ messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; +messages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies; + +messages.reorderQuickReplies#60331907 order:Vector = Bool; + +messages.checkQuickReplyShortcut#f1d0fbd3 shortcut:string = Bool; + +messages.editQuickReplyShortcut#5c003cef shortcut_id:int shortcut:string = Bool; + +messages.deleteQuickReplyShortcut#3cc04740 shortcut_id:int = Bool; + +messages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector hash:long = messages.Messages; + +messages.sendQuickReplyMessages#33153ad4 peer:InputPeer shortcut_id:int = Updates; + +messages.deleteQuickReplyMessages#e105e910 shortcut_id:int id:Vector = Updates; + +messages.toggleDialogFilterTags#fd2dda49 enabled:Bool = Bool; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3210,6 +3304,8 @@ help.getPeerColors#da80f42f hash:int = help.PeerColors; help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; +help.getTimezonesList#49b30240 hash:int = help.TimezonesList; + channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -3586,6 +3682,20 @@ premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; +smsjobs.isEligibleToJoin#edc39d0 = smsjobs.EligibilityToJoin; + +smsjobs.join#a74ece2d = Bool; + +smsjobs.leave#9898ad73 = Bool; + +smsjobs.updateSettings#93fa0bf flags:# allow_international:flags.0?true = Bool; + +smsjobs.getStatus#10a698e8 = smsjobs.Status; + +smsjobs.getSmsJob#778d902f job_id:string = SmsJob; + +smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; + ---types--- @@ -3618,4 +3728,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 174 +// LAYER 176 diff --git a/gen/names.go b/gen/names.go index 749ec7799d..200b2d1e72 100644 --- a/gen/names.go +++ b/gen/names.go @@ -89,12 +89,12 @@ func splitByWords(s string) []string { // pascal converts the given name into a PascalCase. // -// user_info => UserInfo -// full_name => FullName -// user_id => UserID -// full-admin => FullAdmin -// cdnConfig => CDNConfig -// cdn_1_config => CDN1Config +// user_info => UserInfo +// full_name => FullName +// user_id => UserID +// full-admin => FullAdmin +// cdnConfig => CDNConfig +// cdn_1_config => CDN1Config func pascal(s string) string { words := splitByWords(s) return pascalWords(words) @@ -133,7 +133,8 @@ func ruleset() *inflect.Ruleset { } aliases = map[string]string{ - "TCPO": "TCPObfuscated", + "TCPO": "TCPObfuscated", + "SMSJOBS": "SMSJobs", } return r diff --git a/telegram/query/cached/compute_hash.go b/telegram/query/cached/compute_hash.go index f9b3a1ccd6..08dcf7924a 100644 --- a/telegram/query/cached/compute_hash.go +++ b/telegram/query/cached/compute_hash.go @@ -20,3 +20,17 @@ func (s *ContactsGetContacts) computeHash(v *tg.ContactsContacts) int64 { return h.Sum() } + +func (s *MessagesGetQuickReplies) computeHash(v *tg.MessagesQuickReplies) int64 { + r := v.QuickReplies + + sort.SliceStable(r, func(i, j int) bool { + return r[i].ShortcutID < r[j].ShortcutID + }) + h := hasher.Hasher{} + for _, contact := range r { + h.Update(uint32(contact.ShortcutID)) + } + + return h.Sum() +} diff --git a/telegram/query/cached/queries.gen.go b/telegram/query/cached/queries.gen.go index e30f07bc5a..6387bbba10 100644 --- a/telegram/query/cached/queries.gen.go +++ b/telegram/query/cached/queries.gen.go @@ -1698,6 +1698,90 @@ func (s *MessagesGetMaskStickers) Fetch(ctx context.Context) (bool, error) { } } +type innerMessagesGetQuickReplies struct { + // Last received hash. + hash int64 + // Last received result. + value *tg.MessagesQuickReplies +} + +type MessagesGetQuickReplies struct { + // Result state. + last atomic.Value + + // Reference to RPC client to make requests. + raw *tg.Client +} + +// NewMessagesGetQuickReplies creates new MessagesGetQuickReplies. +func NewMessagesGetQuickReplies(raw *tg.Client) *MessagesGetQuickReplies { + q := &MessagesGetQuickReplies{ + raw: raw, + } + + return q +} + +func (s *MessagesGetQuickReplies) store(v innerMessagesGetQuickReplies) { + s.last.Store(v) +} + +func (s *MessagesGetQuickReplies) load() (innerMessagesGetQuickReplies, bool) { + v, ok := s.last.Load().(innerMessagesGetQuickReplies) + return v, ok +} + +// Value returns last received result. +// NB: May be nil. Returned MessagesQuickReplies must not be mutated. +func (s *MessagesGetQuickReplies) Value() *tg.MessagesQuickReplies { + inner, _ := s.load() + return inner.value +} + +// Hash returns last received hash. +func (s *MessagesGetQuickReplies) Hash() int64 { + inner, _ := s.load() + return inner.hash +} + +// Get updates data if needed and returns it. +func (s *MessagesGetQuickReplies) Get(ctx context.Context) (*tg.MessagesQuickReplies, error) { + if _, err := s.Fetch(ctx); err != nil { + return nil, err + } + + return s.Value(), nil +} + +// Fetch updates data if needed and returns true if data was modified. +func (s *MessagesGetQuickReplies) Fetch(ctx context.Context) (bool, error) { + lastHash := s.Hash() + + req := lastHash + result, err := s.raw.MessagesGetQuickReplies(ctx, req) + if err != nil { + return false, errors.Wrap(err, "execute MessagesGetQuickReplies") + } + + switch variant := result.(type) { + case *tg.MessagesQuickReplies: + hash := s.computeHash(variant) + + s.store(innerMessagesGetQuickReplies{ + hash: hash, + value: variant, + }) + return true, nil + case *tg.MessagesQuickRepliesNotModified: + if lastHash == 0 { + return false, errors.Errorf("got unexpected %T result", result) + } + return false, nil + default: + return false, errors.Errorf("unexpected type %T", result) + } +} + type innerMessagesGetRecentReactions struct { // Last received hash. hash int64 diff --git a/tg/tl_account_connected_bots_gen.go b/tg/tl_account_connected_bots_gen.go new file mode 100644 index 0000000000..c38996f8e8 --- /dev/null +++ b/tg/tl_account_connected_bots_gen.go @@ -0,0 +1,226 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountConnectedBots represents TL type `account.connectedBots#17d7f87b`. +// +// See https://core.telegram.org/constructor/account.connectedBots for reference. +type AccountConnectedBots struct { + // ConnectedBots field of AccountConnectedBots. + ConnectedBots []ConnectedBot + // Users field of AccountConnectedBots. + Users []UserClass +} + +// AccountConnectedBotsTypeID is TL type id of AccountConnectedBots. +const AccountConnectedBotsTypeID = 0x17d7f87b + +// Ensuring interfaces in compile-time for AccountConnectedBots. +var ( + _ bin.Encoder = &AccountConnectedBots{} + _ bin.Decoder = &AccountConnectedBots{} + _ bin.BareEncoder = &AccountConnectedBots{} + _ bin.BareDecoder = &AccountConnectedBots{} +) + +func (c *AccountConnectedBots) Zero() bool { + if c == nil { + return true + } + if !(c.ConnectedBots == nil) { + return false + } + if !(c.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *AccountConnectedBots) String() string { + if c == nil { + return "AccountConnectedBots(nil)" + } + type Alias AccountConnectedBots + return fmt.Sprintf("AccountConnectedBots%+v", Alias(*c)) +} + +// FillFrom fills AccountConnectedBots from given interface. +func (c *AccountConnectedBots) FillFrom(from interface { + GetConnectedBots() (value []ConnectedBot) + GetUsers() (value []UserClass) +}) { + c.ConnectedBots = from.GetConnectedBots() + c.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountConnectedBots) TypeID() uint32 { + return AccountConnectedBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountConnectedBots) TypeName() string { + return "account.connectedBots" +} + +// TypeInfo returns info about TL type. +func (c *AccountConnectedBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.connectedBots", + ID: AccountConnectedBotsTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ConnectedBots", + SchemaName: "connected_bots", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *AccountConnectedBots) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode account.connectedBots#17d7f87b as nil") + } + b.PutID(AccountConnectedBotsTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *AccountConnectedBots) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode account.connectedBots#17d7f87b as nil") + } + b.PutVectorHeader(len(c.ConnectedBots)) + for idx, v := range c.ConnectedBots { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.connectedBots#17d7f87b: field connected_bots element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(c.Users)) + for idx, v := range c.Users { + if v == nil { + return fmt.Errorf("unable to encode account.connectedBots#17d7f87b: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.connectedBots#17d7f87b: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (c *AccountConnectedBots) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode account.connectedBots#17d7f87b to nil") + } + if err := b.ConsumeID(AccountConnectedBotsTypeID); err != nil { + return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *AccountConnectedBots) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode account.connectedBots#17d7f87b to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field connected_bots: %w", err) + } + + if headerLen > 0 { + c.ConnectedBots = make([]ConnectedBot, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ConnectedBot + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field connected_bots: %w", err) + } + c.ConnectedBots = append(c.ConnectedBots, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field users: %w", err) + } + + if headerLen > 0 { + c.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field users: %w", err) + } + c.Users = append(c.Users, value) + } + } + return nil +} + +// GetConnectedBots returns value of ConnectedBots field. +func (c *AccountConnectedBots) GetConnectedBots() (value []ConnectedBot) { + if c == nil { + return + } + return c.ConnectedBots +} + +// GetUsers returns value of Users field. +func (c *AccountConnectedBots) GetUsers() (value []UserClass) { + if c == nil { + return + } + return c.Users +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (c *AccountConnectedBots) MapUsers() (value UserClassArray) { + return UserClassArray(c.Users) +} diff --git a/tg/tl_dialog_filter_class_vector_slices_gen.go b/tg/tl_account_connected_bots_slices_gen.go similarity index 100% rename from tg/tl_dialog_filter_class_vector_slices_gen.go rename to tg/tl_account_connected_bots_slices_gen.go diff --git a/tg/tl_account_get_connected_bots_gen.go b/tg/tl_account_get_connected_bots_gen.go new file mode 100644 index 0000000000..2b8bd944f7 --- /dev/null +++ b/tg/tl_account_get_connected_bots_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountGetConnectedBotsRequest represents TL type `account.getConnectedBots#4ea4c80f`. +// +// See https://core.telegram.org/method/account.getConnectedBots for reference. +type AccountGetConnectedBotsRequest struct { +} + +// AccountGetConnectedBotsRequestTypeID is TL type id of AccountGetConnectedBotsRequest. +const AccountGetConnectedBotsRequestTypeID = 0x4ea4c80f + +// Ensuring interfaces in compile-time for AccountGetConnectedBotsRequest. +var ( + _ bin.Encoder = &AccountGetConnectedBotsRequest{} + _ bin.Decoder = &AccountGetConnectedBotsRequest{} + _ bin.BareEncoder = &AccountGetConnectedBotsRequest{} + _ bin.BareDecoder = &AccountGetConnectedBotsRequest{} +) + +func (g *AccountGetConnectedBotsRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *AccountGetConnectedBotsRequest) String() string { + if g == nil { + return "AccountGetConnectedBotsRequest(nil)" + } + type Alias AccountGetConnectedBotsRequest + return fmt.Sprintf("AccountGetConnectedBotsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountGetConnectedBotsRequest) TypeID() uint32 { + return AccountGetConnectedBotsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountGetConnectedBotsRequest) TypeName() string { + return "account.getConnectedBots" +} + +// TypeInfo returns info about TL type. +func (g *AccountGetConnectedBotsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.getConnectedBots", + ID: AccountGetConnectedBotsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *AccountGetConnectedBotsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getConnectedBots#4ea4c80f as nil") + } + b.PutID(AccountGetConnectedBotsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *AccountGetConnectedBotsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getConnectedBots#4ea4c80f as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *AccountGetConnectedBotsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getConnectedBots#4ea4c80f to nil") + } + if err := b.ConsumeID(AccountGetConnectedBotsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.getConnectedBots#4ea4c80f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *AccountGetConnectedBotsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getConnectedBots#4ea4c80f to nil") + } + return nil +} + +// AccountGetConnectedBots invokes method account.getConnectedBots#4ea4c80f returning error if any. +// +// See https://core.telegram.org/method/account.getConnectedBots for reference. +func (c *Client) AccountGetConnectedBots(ctx context.Context) (*AccountConnectedBots, error) { + var result AccountConnectedBots + + request := &AccountGetConnectedBotsRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_account_get_connected_bots_slices_gen.go b/tg/tl_account_get_connected_bots_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_get_connected_bots_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_account_update_business_away_message_gen.go b/tg/tl_account_update_business_away_message_gen.go new file mode 100644 index 0000000000..0ffe8f71ec --- /dev/null +++ b/tg/tl_account_update_business_away_message_gen.go @@ -0,0 +1,213 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountUpdateBusinessAwayMessageRequest represents TL type `account.updateBusinessAwayMessage#a26a7fa5`. +// +// See https://core.telegram.org/method/account.updateBusinessAwayMessage for reference. +type AccountUpdateBusinessAwayMessageRequest struct { + // Flags field of AccountUpdateBusinessAwayMessageRequest. + Flags bin.Fields + // Message field of AccountUpdateBusinessAwayMessageRequest. + // + // Use SetMessage and GetMessage helpers. + Message InputBusinessAwayMessage +} + +// AccountUpdateBusinessAwayMessageRequestTypeID is TL type id of AccountUpdateBusinessAwayMessageRequest. +const AccountUpdateBusinessAwayMessageRequestTypeID = 0xa26a7fa5 + +// Ensuring interfaces in compile-time for AccountUpdateBusinessAwayMessageRequest. +var ( + _ bin.Encoder = &AccountUpdateBusinessAwayMessageRequest{} + _ bin.Decoder = &AccountUpdateBusinessAwayMessageRequest{} + _ bin.BareEncoder = &AccountUpdateBusinessAwayMessageRequest{} + _ bin.BareDecoder = &AccountUpdateBusinessAwayMessageRequest{} +) + +func (u *AccountUpdateBusinessAwayMessageRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.Message.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *AccountUpdateBusinessAwayMessageRequest) String() string { + if u == nil { + return "AccountUpdateBusinessAwayMessageRequest(nil)" + } + type Alias AccountUpdateBusinessAwayMessageRequest + return fmt.Sprintf("AccountUpdateBusinessAwayMessageRequest%+v", Alias(*u)) +} + +// FillFrom fills AccountUpdateBusinessAwayMessageRequest from given interface. +func (u *AccountUpdateBusinessAwayMessageRequest) FillFrom(from interface { + GetMessage() (value InputBusinessAwayMessage, ok bool) +}) { + if val, ok := from.GetMessage(); ok { + u.Message = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountUpdateBusinessAwayMessageRequest) TypeID() uint32 { + return AccountUpdateBusinessAwayMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountUpdateBusinessAwayMessageRequest) TypeName() string { + return "account.updateBusinessAwayMessage" +} + +// TypeInfo returns info about TL type. +func (u *AccountUpdateBusinessAwayMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.updateBusinessAwayMessage", + ID: AccountUpdateBusinessAwayMessageRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *AccountUpdateBusinessAwayMessageRequest) SetFlags() { + if !(u.Message.Zero()) { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *AccountUpdateBusinessAwayMessageRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessAwayMessage#a26a7fa5 as nil") + } + b.PutID(AccountUpdateBusinessAwayMessageRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *AccountUpdateBusinessAwayMessageRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessAwayMessage#a26a7fa5 as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessAwayMessage#a26a7fa5: field flags: %w", err) + } + if u.Flags.Has(0) { + if err := u.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessAwayMessage#a26a7fa5: field message: %w", err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *AccountUpdateBusinessAwayMessageRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessAwayMessage#a26a7fa5 to nil") + } + if err := b.ConsumeID(AccountUpdateBusinessAwayMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessAwayMessage#a26a7fa5: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *AccountUpdateBusinessAwayMessageRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessAwayMessage#a26a7fa5 to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessAwayMessage#a26a7fa5: field flags: %w", err) + } + } + if u.Flags.Has(0) { + if err := u.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessAwayMessage#a26a7fa5: field message: %w", err) + } + } + return nil +} + +// SetMessage sets value of Message conditional field. +func (u *AccountUpdateBusinessAwayMessageRequest) SetMessage(value InputBusinessAwayMessage) { + u.Flags.Set(0) + u.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateBusinessAwayMessageRequest) GetMessage() (value InputBusinessAwayMessage, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.Message, true +} + +// AccountUpdateBusinessAwayMessage invokes method account.updateBusinessAwayMessage#a26a7fa5 returning error if any. +// +// See https://core.telegram.org/method/account.updateBusinessAwayMessage for reference. +func (c *Client) AccountUpdateBusinessAwayMessage(ctx context.Context, request *AccountUpdateBusinessAwayMessageRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_account_update_business_away_message_slices_gen.go b/tg/tl_account_update_business_away_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_update_business_away_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_account_update_business_greeting_message_gen.go b/tg/tl_account_update_business_greeting_message_gen.go new file mode 100644 index 0000000000..8ef99cb5e2 --- /dev/null +++ b/tg/tl_account_update_business_greeting_message_gen.go @@ -0,0 +1,213 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountUpdateBusinessGreetingMessageRequest represents TL type `account.updateBusinessGreetingMessage#66cdafc4`. +// +// See https://core.telegram.org/method/account.updateBusinessGreetingMessage for reference. +type AccountUpdateBusinessGreetingMessageRequest struct { + // Flags field of AccountUpdateBusinessGreetingMessageRequest. + Flags bin.Fields + // Message field of AccountUpdateBusinessGreetingMessageRequest. + // + // Use SetMessage and GetMessage helpers. + Message InputBusinessGreetingMessage +} + +// AccountUpdateBusinessGreetingMessageRequestTypeID is TL type id of AccountUpdateBusinessGreetingMessageRequest. +const AccountUpdateBusinessGreetingMessageRequestTypeID = 0x66cdafc4 + +// Ensuring interfaces in compile-time for AccountUpdateBusinessGreetingMessageRequest. +var ( + _ bin.Encoder = &AccountUpdateBusinessGreetingMessageRequest{} + _ bin.Decoder = &AccountUpdateBusinessGreetingMessageRequest{} + _ bin.BareEncoder = &AccountUpdateBusinessGreetingMessageRequest{} + _ bin.BareDecoder = &AccountUpdateBusinessGreetingMessageRequest{} +) + +func (u *AccountUpdateBusinessGreetingMessageRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.Message.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *AccountUpdateBusinessGreetingMessageRequest) String() string { + if u == nil { + return "AccountUpdateBusinessGreetingMessageRequest(nil)" + } + type Alias AccountUpdateBusinessGreetingMessageRequest + return fmt.Sprintf("AccountUpdateBusinessGreetingMessageRequest%+v", Alias(*u)) +} + +// FillFrom fills AccountUpdateBusinessGreetingMessageRequest from given interface. +func (u *AccountUpdateBusinessGreetingMessageRequest) FillFrom(from interface { + GetMessage() (value InputBusinessGreetingMessage, ok bool) +}) { + if val, ok := from.GetMessage(); ok { + u.Message = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountUpdateBusinessGreetingMessageRequest) TypeID() uint32 { + return AccountUpdateBusinessGreetingMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountUpdateBusinessGreetingMessageRequest) TypeName() string { + return "account.updateBusinessGreetingMessage" +} + +// TypeInfo returns info about TL type. +func (u *AccountUpdateBusinessGreetingMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.updateBusinessGreetingMessage", + ID: AccountUpdateBusinessGreetingMessageRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *AccountUpdateBusinessGreetingMessageRequest) SetFlags() { + if !(u.Message.Zero()) { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *AccountUpdateBusinessGreetingMessageRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessGreetingMessage#66cdafc4 as nil") + } + b.PutID(AccountUpdateBusinessGreetingMessageRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *AccountUpdateBusinessGreetingMessageRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessGreetingMessage#66cdafc4 as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessGreetingMessage#66cdafc4: field flags: %w", err) + } + if u.Flags.Has(0) { + if err := u.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessGreetingMessage#66cdafc4: field message: %w", err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *AccountUpdateBusinessGreetingMessageRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessGreetingMessage#66cdafc4 to nil") + } + if err := b.ConsumeID(AccountUpdateBusinessGreetingMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessGreetingMessage#66cdafc4: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *AccountUpdateBusinessGreetingMessageRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessGreetingMessage#66cdafc4 to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessGreetingMessage#66cdafc4: field flags: %w", err) + } + } + if u.Flags.Has(0) { + if err := u.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessGreetingMessage#66cdafc4: field message: %w", err) + } + } + return nil +} + +// SetMessage sets value of Message conditional field. +func (u *AccountUpdateBusinessGreetingMessageRequest) SetMessage(value InputBusinessGreetingMessage) { + u.Flags.Set(0) + u.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateBusinessGreetingMessageRequest) GetMessage() (value InputBusinessGreetingMessage, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.Message, true +} + +// AccountUpdateBusinessGreetingMessage invokes method account.updateBusinessGreetingMessage#66cdafc4 returning error if any. +// +// See https://core.telegram.org/method/account.updateBusinessGreetingMessage for reference. +func (c *Client) AccountUpdateBusinessGreetingMessage(ctx context.Context, request *AccountUpdateBusinessGreetingMessageRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_account_update_business_greeting_message_slices_gen.go b/tg/tl_account_update_business_greeting_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_update_business_greeting_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_account_update_business_location_gen.go b/tg/tl_account_update_business_location_gen.go new file mode 100644 index 0000000000..2de177c904 --- /dev/null +++ b/tg/tl_account_update_business_location_gen.go @@ -0,0 +1,275 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountUpdateBusinessLocationRequest represents TL type `account.updateBusinessLocation#9e6b131a`. +// +// See https://core.telegram.org/method/account.updateBusinessLocation for reference. +type AccountUpdateBusinessLocationRequest struct { + // Flags field of AccountUpdateBusinessLocationRequest. + Flags bin.Fields + // GeoPoint field of AccountUpdateBusinessLocationRequest. + // + // Use SetGeoPoint and GetGeoPoint helpers. + GeoPoint InputGeoPointClass + // Address field of AccountUpdateBusinessLocationRequest. + // + // Use SetAddress and GetAddress helpers. + Address string +} + +// AccountUpdateBusinessLocationRequestTypeID is TL type id of AccountUpdateBusinessLocationRequest. +const AccountUpdateBusinessLocationRequestTypeID = 0x9e6b131a + +// Ensuring interfaces in compile-time for AccountUpdateBusinessLocationRequest. +var ( + _ bin.Encoder = &AccountUpdateBusinessLocationRequest{} + _ bin.Decoder = &AccountUpdateBusinessLocationRequest{} + _ bin.BareEncoder = &AccountUpdateBusinessLocationRequest{} + _ bin.BareDecoder = &AccountUpdateBusinessLocationRequest{} +) + +func (u *AccountUpdateBusinessLocationRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.GeoPoint == nil) { + return false + } + if !(u.Address == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *AccountUpdateBusinessLocationRequest) String() string { + if u == nil { + return "AccountUpdateBusinessLocationRequest(nil)" + } + type Alias AccountUpdateBusinessLocationRequest + return fmt.Sprintf("AccountUpdateBusinessLocationRequest%+v", Alias(*u)) +} + +// FillFrom fills AccountUpdateBusinessLocationRequest from given interface. +func (u *AccountUpdateBusinessLocationRequest) FillFrom(from interface { + GetGeoPoint() (value InputGeoPointClass, ok bool) + GetAddress() (value string, ok bool) +}) { + if val, ok := from.GetGeoPoint(); ok { + u.GeoPoint = val + } + + if val, ok := from.GetAddress(); ok { + u.Address = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountUpdateBusinessLocationRequest) TypeID() uint32 { + return AccountUpdateBusinessLocationRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountUpdateBusinessLocationRequest) TypeName() string { + return "account.updateBusinessLocation" +} + +// TypeInfo returns info about TL type. +func (u *AccountUpdateBusinessLocationRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.updateBusinessLocation", + ID: AccountUpdateBusinessLocationRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GeoPoint", + SchemaName: "geo_point", + Null: !u.Flags.Has(1), + }, + { + Name: "Address", + SchemaName: "address", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *AccountUpdateBusinessLocationRequest) SetFlags() { + if !(u.GeoPoint == nil) { + u.Flags.Set(1) + } + if !(u.Address == "") { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *AccountUpdateBusinessLocationRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessLocation#9e6b131a as nil") + } + b.PutID(AccountUpdateBusinessLocationRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *AccountUpdateBusinessLocationRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessLocation#9e6b131a as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessLocation#9e6b131a: field flags: %w", err) + } + if u.Flags.Has(1) { + if u.GeoPoint == nil { + return fmt.Errorf("unable to encode account.updateBusinessLocation#9e6b131a: field geo_point is nil") + } + if err := u.GeoPoint.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessLocation#9e6b131a: field geo_point: %w", err) + } + } + if u.Flags.Has(0) { + b.PutString(u.Address) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *AccountUpdateBusinessLocationRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessLocation#9e6b131a to nil") + } + if err := b.ConsumeID(AccountUpdateBusinessLocationRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *AccountUpdateBusinessLocationRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessLocation#9e6b131a to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: field flags: %w", err) + } + } + if u.Flags.Has(1) { + value, err := DecodeInputGeoPoint(b) + if err != nil { + return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: field geo_point: %w", err) + } + u.GeoPoint = value + } + if u.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: field address: %w", err) + } + u.Address = value + } + return nil +} + +// SetGeoPoint sets value of GeoPoint conditional field. +func (u *AccountUpdateBusinessLocationRequest) SetGeoPoint(value InputGeoPointClass) { + u.Flags.Set(1) + u.GeoPoint = value +} + +// GetGeoPoint returns value of GeoPoint conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateBusinessLocationRequest) GetGeoPoint() (value InputGeoPointClass, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(1) { + return value, false + } + return u.GeoPoint, true +} + +// SetAddress sets value of Address conditional field. +func (u *AccountUpdateBusinessLocationRequest) SetAddress(value string) { + u.Flags.Set(0) + u.Address = value +} + +// GetAddress returns value of Address conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateBusinessLocationRequest) GetAddress() (value string, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.Address, true +} + +// GetGeoPointAsNotEmpty returns mapped value of GeoPoint conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateBusinessLocationRequest) GetGeoPointAsNotEmpty() (*InputGeoPoint, bool) { + if value, ok := u.GetGeoPoint(); ok { + return value.AsNotEmpty() + } + return nil, false +} + +// AccountUpdateBusinessLocation invokes method account.updateBusinessLocation#9e6b131a returning error if any. +// +// See https://core.telegram.org/method/account.updateBusinessLocation for reference. +func (c *Client) AccountUpdateBusinessLocation(ctx context.Context, request *AccountUpdateBusinessLocationRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_account_update_business_location_slices_gen.go b/tg/tl_account_update_business_location_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_update_business_location_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_account_update_business_work_hours_gen.go b/tg/tl_account_update_business_work_hours_gen.go new file mode 100644 index 0000000000..d0d36ce4aa --- /dev/null +++ b/tg/tl_account_update_business_work_hours_gen.go @@ -0,0 +1,213 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountUpdateBusinessWorkHoursRequest represents TL type `account.updateBusinessWorkHours#4b00e066`. +// +// See https://core.telegram.org/method/account.updateBusinessWorkHours for reference. +type AccountUpdateBusinessWorkHoursRequest struct { + // Flags field of AccountUpdateBusinessWorkHoursRequest. + Flags bin.Fields + // BusinessWorkHours field of AccountUpdateBusinessWorkHoursRequest. + // + // Use SetBusinessWorkHours and GetBusinessWorkHours helpers. + BusinessWorkHours BusinessWorkHours +} + +// AccountUpdateBusinessWorkHoursRequestTypeID is TL type id of AccountUpdateBusinessWorkHoursRequest. +const AccountUpdateBusinessWorkHoursRequestTypeID = 0x4b00e066 + +// Ensuring interfaces in compile-time for AccountUpdateBusinessWorkHoursRequest. +var ( + _ bin.Encoder = &AccountUpdateBusinessWorkHoursRequest{} + _ bin.Decoder = &AccountUpdateBusinessWorkHoursRequest{} + _ bin.BareEncoder = &AccountUpdateBusinessWorkHoursRequest{} + _ bin.BareDecoder = &AccountUpdateBusinessWorkHoursRequest{} +) + +func (u *AccountUpdateBusinessWorkHoursRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.BusinessWorkHours.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *AccountUpdateBusinessWorkHoursRequest) String() string { + if u == nil { + return "AccountUpdateBusinessWorkHoursRequest(nil)" + } + type Alias AccountUpdateBusinessWorkHoursRequest + return fmt.Sprintf("AccountUpdateBusinessWorkHoursRequest%+v", Alias(*u)) +} + +// FillFrom fills AccountUpdateBusinessWorkHoursRequest from given interface. +func (u *AccountUpdateBusinessWorkHoursRequest) FillFrom(from interface { + GetBusinessWorkHours() (value BusinessWorkHours, ok bool) +}) { + if val, ok := from.GetBusinessWorkHours(); ok { + u.BusinessWorkHours = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountUpdateBusinessWorkHoursRequest) TypeID() uint32 { + return AccountUpdateBusinessWorkHoursRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountUpdateBusinessWorkHoursRequest) TypeName() string { + return "account.updateBusinessWorkHours" +} + +// TypeInfo returns info about TL type. +func (u *AccountUpdateBusinessWorkHoursRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.updateBusinessWorkHours", + ID: AccountUpdateBusinessWorkHoursRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BusinessWorkHours", + SchemaName: "business_work_hours", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *AccountUpdateBusinessWorkHoursRequest) SetFlags() { + if !(u.BusinessWorkHours.Zero()) { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *AccountUpdateBusinessWorkHoursRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessWorkHours#4b00e066 as nil") + } + b.PutID(AccountUpdateBusinessWorkHoursRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *AccountUpdateBusinessWorkHoursRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateBusinessWorkHours#4b00e066 as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessWorkHours#4b00e066: field flags: %w", err) + } + if u.Flags.Has(0) { + if err := u.BusinessWorkHours.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateBusinessWorkHours#4b00e066: field business_work_hours: %w", err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *AccountUpdateBusinessWorkHoursRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessWorkHours#4b00e066 to nil") + } + if err := b.ConsumeID(AccountUpdateBusinessWorkHoursRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessWorkHours#4b00e066: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *AccountUpdateBusinessWorkHoursRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateBusinessWorkHours#4b00e066 to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessWorkHours#4b00e066: field flags: %w", err) + } + } + if u.Flags.Has(0) { + if err := u.BusinessWorkHours.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateBusinessWorkHours#4b00e066: field business_work_hours: %w", err) + } + } + return nil +} + +// SetBusinessWorkHours sets value of BusinessWorkHours conditional field. +func (u *AccountUpdateBusinessWorkHoursRequest) SetBusinessWorkHours(value BusinessWorkHours) { + u.Flags.Set(0) + u.BusinessWorkHours = value +} + +// GetBusinessWorkHours returns value of BusinessWorkHours conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateBusinessWorkHoursRequest) GetBusinessWorkHours() (value BusinessWorkHours, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.BusinessWorkHours, true +} + +// AccountUpdateBusinessWorkHours invokes method account.updateBusinessWorkHours#4b00e066 returning error if any. +// +// See https://core.telegram.org/method/account.updateBusinessWorkHours for reference. +func (c *Client) AccountUpdateBusinessWorkHours(ctx context.Context, request *AccountUpdateBusinessWorkHoursRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_account_update_business_work_hours_slices_gen.go b/tg/tl_account_update_business_work_hours_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_update_business_work_hours_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_account_update_connected_bot_gen.go b/tg/tl_account_update_connected_bot_gen.go new file mode 100644 index 0000000000..71feb5b5e6 --- /dev/null +++ b/tg/tl_account_update_connected_bot_gen.go @@ -0,0 +1,293 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountUpdateConnectedBotRequest represents TL type `account.updateConnectedBot#9c2d527d`. +// +// See https://core.telegram.org/method/account.updateConnectedBot for reference. +type AccountUpdateConnectedBotRequest struct { + // Flags field of AccountUpdateConnectedBotRequest. + Flags bin.Fields + // CanReply field of AccountUpdateConnectedBotRequest. + CanReply bool + // Deleted field of AccountUpdateConnectedBotRequest. + Deleted bool + // Bot field of AccountUpdateConnectedBotRequest. + Bot InputUserClass + // Recipients field of AccountUpdateConnectedBotRequest. + Recipients InputBusinessRecipients +} + +// AccountUpdateConnectedBotRequestTypeID is TL type id of AccountUpdateConnectedBotRequest. +const AccountUpdateConnectedBotRequestTypeID = 0x9c2d527d + +// Ensuring interfaces in compile-time for AccountUpdateConnectedBotRequest. +var ( + _ bin.Encoder = &AccountUpdateConnectedBotRequest{} + _ bin.Decoder = &AccountUpdateConnectedBotRequest{} + _ bin.BareEncoder = &AccountUpdateConnectedBotRequest{} + _ bin.BareDecoder = &AccountUpdateConnectedBotRequest{} +) + +func (u *AccountUpdateConnectedBotRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.CanReply == false) { + return false + } + if !(u.Deleted == false) { + return false + } + if !(u.Bot == nil) { + return false + } + if !(u.Recipients.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *AccountUpdateConnectedBotRequest) String() string { + if u == nil { + return "AccountUpdateConnectedBotRequest(nil)" + } + type Alias AccountUpdateConnectedBotRequest + return fmt.Sprintf("AccountUpdateConnectedBotRequest%+v", Alias(*u)) +} + +// FillFrom fills AccountUpdateConnectedBotRequest from given interface. +func (u *AccountUpdateConnectedBotRequest) FillFrom(from interface { + GetCanReply() (value bool) + GetDeleted() (value bool) + GetBot() (value InputUserClass) + GetRecipients() (value InputBusinessRecipients) +}) { + u.CanReply = from.GetCanReply() + u.Deleted = from.GetDeleted() + u.Bot = from.GetBot() + u.Recipients = from.GetRecipients() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountUpdateConnectedBotRequest) TypeID() uint32 { + return AccountUpdateConnectedBotRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountUpdateConnectedBotRequest) TypeName() string { + return "account.updateConnectedBot" +} + +// TypeInfo returns info about TL type. +func (u *AccountUpdateConnectedBotRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.updateConnectedBot", + ID: AccountUpdateConnectedBotRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CanReply", + SchemaName: "can_reply", + Null: !u.Flags.Has(0), + }, + { + Name: "Deleted", + SchemaName: "deleted", + Null: !u.Flags.Has(1), + }, + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *AccountUpdateConnectedBotRequest) SetFlags() { + if !(u.CanReply == false) { + u.Flags.Set(0) + } + if !(u.Deleted == false) { + u.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (u *AccountUpdateConnectedBotRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateConnectedBot#9c2d527d as nil") + } + b.PutID(AccountUpdateConnectedBotRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *AccountUpdateConnectedBotRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode account.updateConnectedBot#9c2d527d as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateConnectedBot#9c2d527d: field flags: %w", err) + } + if u.Bot == nil { + return fmt.Errorf("unable to encode account.updateConnectedBot#9c2d527d: field bot is nil") + } + if err := u.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateConnectedBot#9c2d527d: field bot: %w", err) + } + if err := u.Recipients.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.updateConnectedBot#9c2d527d: field recipients: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *AccountUpdateConnectedBotRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateConnectedBot#9c2d527d to nil") + } + if err := b.ConsumeID(AccountUpdateConnectedBotRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.updateConnectedBot#9c2d527d: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *AccountUpdateConnectedBotRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode account.updateConnectedBot#9c2d527d to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateConnectedBot#9c2d527d: field flags: %w", err) + } + } + u.CanReply = u.Flags.Has(0) + u.Deleted = u.Flags.Has(1) + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode account.updateConnectedBot#9c2d527d: field bot: %w", err) + } + u.Bot = value + } + { + if err := u.Recipients.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.updateConnectedBot#9c2d527d: field recipients: %w", err) + } + } + return nil +} + +// SetCanReply sets value of CanReply conditional field. +func (u *AccountUpdateConnectedBotRequest) SetCanReply(value bool) { + if value { + u.Flags.Set(0) + u.CanReply = true + } else { + u.Flags.Unset(0) + u.CanReply = false + } +} + +// GetCanReply returns value of CanReply conditional field. +func (u *AccountUpdateConnectedBotRequest) GetCanReply() (value bool) { + if u == nil { + return + } + return u.Flags.Has(0) +} + +// SetDeleted sets value of Deleted conditional field. +func (u *AccountUpdateConnectedBotRequest) SetDeleted(value bool) { + if value { + u.Flags.Set(1) + u.Deleted = true + } else { + u.Flags.Unset(1) + u.Deleted = false + } +} + +// GetDeleted returns value of Deleted conditional field. +func (u *AccountUpdateConnectedBotRequest) GetDeleted() (value bool) { + if u == nil { + return + } + return u.Flags.Has(1) +} + +// GetBot returns value of Bot field. +func (u *AccountUpdateConnectedBotRequest) GetBot() (value InputUserClass) { + if u == nil { + return + } + return u.Bot +} + +// GetRecipients returns value of Recipients field. +func (u *AccountUpdateConnectedBotRequest) GetRecipients() (value InputBusinessRecipients) { + if u == nil { + return + } + return u.Recipients +} + +// AccountUpdateConnectedBot invokes method account.updateConnectedBot#9c2d527d returning error if any. +// +// See https://core.telegram.org/method/account.updateConnectedBot for reference. +func (c *Client) AccountUpdateConnectedBot(ctx context.Context, request *AccountUpdateConnectedBotRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_account_update_connected_bot_slices_gen.go b/tg/tl_account_update_connected_bot_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_update_connected_bot_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_business_away_message_gen.go b/tg/tl_business_away_message_gen.go new file mode 100644 index 0000000000..236faffdcf --- /dev/null +++ b/tg/tl_business_away_message_gen.go @@ -0,0 +1,273 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessAwayMessage represents TL type `businessAwayMessage#ef156a5c`. +// +// See https://core.telegram.org/constructor/businessAwayMessage for reference. +type BusinessAwayMessage struct { + // Flags field of BusinessAwayMessage. + Flags bin.Fields + // OfflineOnly field of BusinessAwayMessage. + OfflineOnly bool + // ShortcutID field of BusinessAwayMessage. + ShortcutID int + // Schedule field of BusinessAwayMessage. + Schedule BusinessAwayMessageScheduleClass + // Recipients field of BusinessAwayMessage. + Recipients BusinessRecipients +} + +// BusinessAwayMessageTypeID is TL type id of BusinessAwayMessage. +const BusinessAwayMessageTypeID = 0xef156a5c + +// Ensuring interfaces in compile-time for BusinessAwayMessage. +var ( + _ bin.Encoder = &BusinessAwayMessage{} + _ bin.Decoder = &BusinessAwayMessage{} + _ bin.BareEncoder = &BusinessAwayMessage{} + _ bin.BareDecoder = &BusinessAwayMessage{} +) + +func (b *BusinessAwayMessage) Zero() bool { + if b == nil { + return true + } + if !(b.Flags.Zero()) { + return false + } + if !(b.OfflineOnly == false) { + return false + } + if !(b.ShortcutID == 0) { + return false + } + if !(b.Schedule == nil) { + return false + } + if !(b.Recipients.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessage) String() string { + if b == nil { + return "BusinessAwayMessage(nil)" + } + type Alias BusinessAwayMessage + return fmt.Sprintf("BusinessAwayMessage%+v", Alias(*b)) +} + +// FillFrom fills BusinessAwayMessage from given interface. +func (b *BusinessAwayMessage) FillFrom(from interface { + GetOfflineOnly() (value bool) + GetShortcutID() (value int) + GetSchedule() (value BusinessAwayMessageScheduleClass) + GetRecipients() (value BusinessRecipients) +}) { + b.OfflineOnly = from.GetOfflineOnly() + b.ShortcutID = from.GetShortcutID() + b.Schedule = from.GetSchedule() + b.Recipients = from.GetRecipients() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessage) TypeID() uint32 { + return BusinessAwayMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessage) TypeName() string { + return "businessAwayMessage" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessage", + ID: BusinessAwayMessageTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OfflineOnly", + SchemaName: "offline_only", + Null: !b.Flags.Has(0), + }, + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Schedule", + SchemaName: "schedule", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (b *BusinessAwayMessage) SetFlags() { + if !(b.OfflineOnly == false) { + b.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessage) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessage#ef156a5c as nil") + } + buf.PutID(BusinessAwayMessageTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessage) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessage#ef156a5c as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessage#ef156a5c: field flags: %w", err) + } + buf.PutInt(b.ShortcutID) + if b.Schedule == nil { + return fmt.Errorf("unable to encode businessAwayMessage#ef156a5c: field schedule is nil") + } + if err := b.Schedule.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessage#ef156a5c: field schedule: %w", err) + } + if err := b.Recipients.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessAwayMessage#ef156a5c: field recipients: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessage) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessage#ef156a5c to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessage#ef156a5c: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessage) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessage#ef156a5c to nil") + } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessAwayMessage#ef156a5c: field flags: %w", err) + } + } + b.OfflineOnly = b.Flags.Has(0) + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessage#ef156a5c: field shortcut_id: %w", err) + } + b.ShortcutID = value + } + { + value, err := DecodeBusinessAwayMessageSchedule(buf) + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessage#ef156a5c: field schedule: %w", err) + } + b.Schedule = value + } + { + if err := b.Recipients.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessAwayMessage#ef156a5c: field recipients: %w", err) + } + } + return nil +} + +// SetOfflineOnly sets value of OfflineOnly conditional field. +func (b *BusinessAwayMessage) SetOfflineOnly(value bool) { + if value { + b.Flags.Set(0) + b.OfflineOnly = true + } else { + b.Flags.Unset(0) + b.OfflineOnly = false + } +} + +// GetOfflineOnly returns value of OfflineOnly conditional field. +func (b *BusinessAwayMessage) GetOfflineOnly() (value bool) { + if b == nil { + return + } + return b.Flags.Has(0) +} + +// GetShortcutID returns value of ShortcutID field. +func (b *BusinessAwayMessage) GetShortcutID() (value int) { + if b == nil { + return + } + return b.ShortcutID +} + +// GetSchedule returns value of Schedule field. +func (b *BusinessAwayMessage) GetSchedule() (value BusinessAwayMessageScheduleClass) { + if b == nil { + return + } + return b.Schedule +} + +// GetRecipients returns value of Recipients field. +func (b *BusinessAwayMessage) GetRecipients() (value BusinessRecipients) { + if b == nil { + return + } + return b.Recipients +} diff --git a/tg/tl_business_away_message_schedule_gen.go b/tg/tl_business_away_message_schedule_gen.go new file mode 100644 index 0000000000..836a884e5a --- /dev/null +++ b/tg/tl_business_away_message_schedule_gen.go @@ -0,0 +1,494 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessAwayMessageScheduleAlways represents TL type `businessAwayMessageScheduleAlways#c9b9e2b9`. +// +// See https://core.telegram.org/constructor/businessAwayMessageScheduleAlways for reference. +type BusinessAwayMessageScheduleAlways struct { +} + +// BusinessAwayMessageScheduleAlwaysTypeID is TL type id of BusinessAwayMessageScheduleAlways. +const BusinessAwayMessageScheduleAlwaysTypeID = 0xc9b9e2b9 + +// construct implements constructor of BusinessAwayMessageScheduleClass. +func (b BusinessAwayMessageScheduleAlways) construct() BusinessAwayMessageScheduleClass { return &b } + +// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleAlways. +var ( + _ bin.Encoder = &BusinessAwayMessageScheduleAlways{} + _ bin.Decoder = &BusinessAwayMessageScheduleAlways{} + _ bin.BareEncoder = &BusinessAwayMessageScheduleAlways{} + _ bin.BareDecoder = &BusinessAwayMessageScheduleAlways{} + + _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleAlways{} +) + +func (b *BusinessAwayMessageScheduleAlways) Zero() bool { + if b == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageScheduleAlways) String() string { + if b == nil { + return "BusinessAwayMessageScheduleAlways(nil)" + } + type Alias BusinessAwayMessageScheduleAlways + return fmt.Sprintf("BusinessAwayMessageScheduleAlways%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageScheduleAlways) TypeID() uint32 { + return BusinessAwayMessageScheduleAlwaysTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageScheduleAlways) TypeName() string { + return "businessAwayMessageScheduleAlways" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageScheduleAlways) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageScheduleAlways", + ID: BusinessAwayMessageScheduleAlwaysTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageScheduleAlways) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleAlways#c9b9e2b9 as nil") + } + buf.PutID(BusinessAwayMessageScheduleAlwaysTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageScheduleAlways) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleAlways#c9b9e2b9 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageScheduleAlways) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleAlways#c9b9e2b9 to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageScheduleAlwaysTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleAlways#c9b9e2b9: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageScheduleAlways) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleAlways#c9b9e2b9 to nil") + } + return nil +} + +// BusinessAwayMessageScheduleOutsideWorkHours represents TL type `businessAwayMessageScheduleOutsideWorkHours#c3f2f501`. +// +// See https://core.telegram.org/constructor/businessAwayMessageScheduleOutsideWorkHours for reference. +type BusinessAwayMessageScheduleOutsideWorkHours struct { +} + +// BusinessAwayMessageScheduleOutsideWorkHoursTypeID is TL type id of BusinessAwayMessageScheduleOutsideWorkHours. +const BusinessAwayMessageScheduleOutsideWorkHoursTypeID = 0xc3f2f501 + +// construct implements constructor of BusinessAwayMessageScheduleClass. +func (b BusinessAwayMessageScheduleOutsideWorkHours) construct() BusinessAwayMessageScheduleClass { + return &b +} + +// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleOutsideWorkHours. +var ( + _ bin.Encoder = &BusinessAwayMessageScheduleOutsideWorkHours{} + _ bin.Decoder = &BusinessAwayMessageScheduleOutsideWorkHours{} + _ bin.BareEncoder = &BusinessAwayMessageScheduleOutsideWorkHours{} + _ bin.BareDecoder = &BusinessAwayMessageScheduleOutsideWorkHours{} + + _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleOutsideWorkHours{} +) + +func (b *BusinessAwayMessageScheduleOutsideWorkHours) Zero() bool { + if b == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageScheduleOutsideWorkHours) String() string { + if b == nil { + return "BusinessAwayMessageScheduleOutsideWorkHours(nil)" + } + type Alias BusinessAwayMessageScheduleOutsideWorkHours + return fmt.Sprintf("BusinessAwayMessageScheduleOutsideWorkHours%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageScheduleOutsideWorkHours) TypeID() uint32 { + return BusinessAwayMessageScheduleOutsideWorkHoursTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageScheduleOutsideWorkHours) TypeName() string { + return "businessAwayMessageScheduleOutsideWorkHours" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageScheduleOutsideWorkHours) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageScheduleOutsideWorkHours", + ID: BusinessAwayMessageScheduleOutsideWorkHoursTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageScheduleOutsideWorkHours) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideWorkHours#c3f2f501 as nil") + } + buf.PutID(BusinessAwayMessageScheduleOutsideWorkHoursTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageScheduleOutsideWorkHours) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideWorkHours#c3f2f501 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageScheduleOutsideWorkHours) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideWorkHours#c3f2f501 to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageScheduleOutsideWorkHoursTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleOutsideWorkHours#c3f2f501: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageScheduleOutsideWorkHours) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideWorkHours#c3f2f501 to nil") + } + return nil +} + +// BusinessAwayMessageScheduleCustom represents TL type `businessAwayMessageScheduleCustom#cc4d9ecc`. +// +// See https://core.telegram.org/constructor/businessAwayMessageScheduleCustom for reference. +type BusinessAwayMessageScheduleCustom struct { + // StartDate field of BusinessAwayMessageScheduleCustom. + StartDate int + // EndDate field of BusinessAwayMessageScheduleCustom. + EndDate int +} + +// BusinessAwayMessageScheduleCustomTypeID is TL type id of BusinessAwayMessageScheduleCustom. +const BusinessAwayMessageScheduleCustomTypeID = 0xcc4d9ecc + +// construct implements constructor of BusinessAwayMessageScheduleClass. +func (b BusinessAwayMessageScheduleCustom) construct() BusinessAwayMessageScheduleClass { return &b } + +// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleCustom. +var ( + _ bin.Encoder = &BusinessAwayMessageScheduleCustom{} + _ bin.Decoder = &BusinessAwayMessageScheduleCustom{} + _ bin.BareEncoder = &BusinessAwayMessageScheduleCustom{} + _ bin.BareDecoder = &BusinessAwayMessageScheduleCustom{} + + _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleCustom{} +) + +func (b *BusinessAwayMessageScheduleCustom) Zero() bool { + if b == nil { + return true + } + if !(b.StartDate == 0) { + return false + } + if !(b.EndDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessAwayMessageScheduleCustom) String() string { + if b == nil { + return "BusinessAwayMessageScheduleCustom(nil)" + } + type Alias BusinessAwayMessageScheduleCustom + return fmt.Sprintf("BusinessAwayMessageScheduleCustom%+v", Alias(*b)) +} + +// FillFrom fills BusinessAwayMessageScheduleCustom from given interface. +func (b *BusinessAwayMessageScheduleCustom) FillFrom(from interface { + GetStartDate() (value int) + GetEndDate() (value int) +}) { + b.StartDate = from.GetStartDate() + b.EndDate = from.GetEndDate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessAwayMessageScheduleCustom) TypeID() uint32 { + return BusinessAwayMessageScheduleCustomTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessAwayMessageScheduleCustom) TypeName() string { + return "businessAwayMessageScheduleCustom" +} + +// TypeInfo returns info about TL type. +func (b *BusinessAwayMessageScheduleCustom) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessAwayMessageScheduleCustom", + ID: BusinessAwayMessageScheduleCustomTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StartDate", + SchemaName: "start_date", + }, + { + Name: "EndDate", + SchemaName: "end_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessAwayMessageScheduleCustom) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleCustom#cc4d9ecc as nil") + } + buf.PutID(BusinessAwayMessageScheduleCustomTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessAwayMessageScheduleCustom) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessAwayMessageScheduleCustom#cc4d9ecc as nil") + } + buf.PutInt(b.StartDate) + buf.PutInt(b.EndDate) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessAwayMessageScheduleCustom) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleCustom#cc4d9ecc to nil") + } + if err := buf.ConsumeID(BusinessAwayMessageScheduleCustomTypeID); err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#cc4d9ecc: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessAwayMessageScheduleCustom) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessAwayMessageScheduleCustom#cc4d9ecc to nil") + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#cc4d9ecc: field start_date: %w", err) + } + b.StartDate = value + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#cc4d9ecc: field end_date: %w", err) + } + b.EndDate = value + } + return nil +} + +// GetStartDate returns value of StartDate field. +func (b *BusinessAwayMessageScheduleCustom) GetStartDate() (value int) { + if b == nil { + return + } + return b.StartDate +} + +// GetEndDate returns value of EndDate field. +func (b *BusinessAwayMessageScheduleCustom) GetEndDate() (value int) { + if b == nil { + return + } + return b.EndDate +} + +// BusinessAwayMessageScheduleClassName is schema name of BusinessAwayMessageScheduleClass. +const BusinessAwayMessageScheduleClassName = "BusinessAwayMessageSchedule" + +// BusinessAwayMessageScheduleClass represents BusinessAwayMessageSchedule generic type. +// +// See https://core.telegram.org/type/BusinessAwayMessageSchedule for reference. +// +// Example: +// +// g, err := tg.DecodeBusinessAwayMessageSchedule(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.BusinessAwayMessageScheduleAlways: // businessAwayMessageScheduleAlways#c9b9e2b9 +// case *tg.BusinessAwayMessageScheduleOutsideWorkHours: // businessAwayMessageScheduleOutsideWorkHours#c3f2f501 +// case *tg.BusinessAwayMessageScheduleCustom: // businessAwayMessageScheduleCustom#cc4d9ecc +// default: panic(v) +// } +type BusinessAwayMessageScheduleClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() BusinessAwayMessageScheduleClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool +} + +// DecodeBusinessAwayMessageSchedule implements binary de-serialization for BusinessAwayMessageScheduleClass. +func DecodeBusinessAwayMessageSchedule(buf *bin.Buffer) (BusinessAwayMessageScheduleClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case BusinessAwayMessageScheduleAlwaysTypeID: + // Decoding businessAwayMessageScheduleAlways#c9b9e2b9. + v := BusinessAwayMessageScheduleAlways{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + case BusinessAwayMessageScheduleOutsideWorkHoursTypeID: + // Decoding businessAwayMessageScheduleOutsideWorkHours#c3f2f501. + v := BusinessAwayMessageScheduleOutsideWorkHours{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + case BusinessAwayMessageScheduleCustomTypeID: + // Decoding businessAwayMessageScheduleCustom#cc4d9ecc. + v := BusinessAwayMessageScheduleCustom{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", bin.NewUnexpectedID(id)) + } +} + +// BusinessAwayMessageSchedule boxes the BusinessAwayMessageScheduleClass providing a helper. +type BusinessAwayMessageScheduleBox struct { + BusinessAwayMessageSchedule BusinessAwayMessageScheduleClass +} + +// Decode implements bin.Decoder for BusinessAwayMessageScheduleBox. +func (b *BusinessAwayMessageScheduleBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode BusinessAwayMessageScheduleBox to nil") + } + v, err := DecodeBusinessAwayMessageSchedule(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.BusinessAwayMessageSchedule = v + return nil +} + +// Encode implements bin.Encode for BusinessAwayMessageScheduleBox. +func (b *BusinessAwayMessageScheduleBox) Encode(buf *bin.Buffer) error { + if b == nil || b.BusinessAwayMessageSchedule == nil { + return fmt.Errorf("unable to encode BusinessAwayMessageScheduleClass as nil") + } + return b.BusinessAwayMessageSchedule.Encode(buf) +} diff --git a/tg/tl_business_away_message_schedule_slices_gen.go b/tg/tl_business_away_message_schedule_slices_gen.go new file mode 100644 index 0000000000..318a853c86 --- /dev/null +++ b/tg/tl_business_away_message_schedule_slices_gen.go @@ -0,0 +1,212 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessAwayMessageScheduleClassArray is adapter for slice of BusinessAwayMessageScheduleClass. +type BusinessAwayMessageScheduleClassArray []BusinessAwayMessageScheduleClass + +// Sort sorts slice of BusinessAwayMessageScheduleClass. +func (s BusinessAwayMessageScheduleClassArray) Sort(less func(a, b BusinessAwayMessageScheduleClass) bool) BusinessAwayMessageScheduleClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of BusinessAwayMessageScheduleClass. +func (s BusinessAwayMessageScheduleClassArray) SortStable(less func(a, b BusinessAwayMessageScheduleClass) bool) BusinessAwayMessageScheduleClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of BusinessAwayMessageScheduleClass. +func (s BusinessAwayMessageScheduleClassArray) Retain(keep func(x BusinessAwayMessageScheduleClass) bool) BusinessAwayMessageScheduleClassArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s BusinessAwayMessageScheduleClassArray) First() (v BusinessAwayMessageScheduleClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s BusinessAwayMessageScheduleClassArray) Last() (v BusinessAwayMessageScheduleClass, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *BusinessAwayMessageScheduleClassArray) PopFirst() (v BusinessAwayMessageScheduleClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero BusinessAwayMessageScheduleClass + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *BusinessAwayMessageScheduleClassArray) Pop() (v BusinessAwayMessageScheduleClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// AsBusinessAwayMessageScheduleCustom returns copy with only BusinessAwayMessageScheduleCustom constructors. +func (s BusinessAwayMessageScheduleClassArray) AsBusinessAwayMessageScheduleCustom() (to BusinessAwayMessageScheduleCustomArray) { + for _, elem := range s { + value, ok := elem.(*BusinessAwayMessageScheduleCustom) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// BusinessAwayMessageScheduleCustomArray is adapter for slice of BusinessAwayMessageScheduleCustom. +type BusinessAwayMessageScheduleCustomArray []BusinessAwayMessageScheduleCustom + +// Sort sorts slice of BusinessAwayMessageScheduleCustom. +func (s BusinessAwayMessageScheduleCustomArray) Sort(less func(a, b BusinessAwayMessageScheduleCustom) bool) BusinessAwayMessageScheduleCustomArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of BusinessAwayMessageScheduleCustom. +func (s BusinessAwayMessageScheduleCustomArray) SortStable(less func(a, b BusinessAwayMessageScheduleCustom) bool) BusinessAwayMessageScheduleCustomArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of BusinessAwayMessageScheduleCustom. +func (s BusinessAwayMessageScheduleCustomArray) Retain(keep func(x BusinessAwayMessageScheduleCustom) bool) BusinessAwayMessageScheduleCustomArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s BusinessAwayMessageScheduleCustomArray) First() (v BusinessAwayMessageScheduleCustom, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s BusinessAwayMessageScheduleCustomArray) Last() (v BusinessAwayMessageScheduleCustom, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *BusinessAwayMessageScheduleCustomArray) PopFirst() (v BusinessAwayMessageScheduleCustom, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero BusinessAwayMessageScheduleCustom + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *BusinessAwayMessageScheduleCustomArray) Pop() (v BusinessAwayMessageScheduleCustom, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_business_away_message_slices_gen.go b/tg/tl_business_away_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_business_away_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_business_greeting_message_gen.go b/tg/tl_business_greeting_message_gen.go new file mode 100644 index 0000000000..a8e29ed3b7 --- /dev/null +++ b/tg/tl_business_greeting_message_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessGreetingMessage represents TL type `businessGreetingMessage#e519abab`. +// +// See https://core.telegram.org/constructor/businessGreetingMessage for reference. +type BusinessGreetingMessage struct { + // ShortcutID field of BusinessGreetingMessage. + ShortcutID int + // Recipients field of BusinessGreetingMessage. + Recipients BusinessRecipients + // NoActivityDays field of BusinessGreetingMessage. + NoActivityDays int +} + +// BusinessGreetingMessageTypeID is TL type id of BusinessGreetingMessage. +const BusinessGreetingMessageTypeID = 0xe519abab + +// Ensuring interfaces in compile-time for BusinessGreetingMessage. +var ( + _ bin.Encoder = &BusinessGreetingMessage{} + _ bin.Decoder = &BusinessGreetingMessage{} + _ bin.BareEncoder = &BusinessGreetingMessage{} + _ bin.BareDecoder = &BusinessGreetingMessage{} +) + +func (b *BusinessGreetingMessage) Zero() bool { + if b == nil { + return true + } + if !(b.ShortcutID == 0) { + return false + } + if !(b.Recipients.Zero()) { + return false + } + if !(b.NoActivityDays == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessGreetingMessage) String() string { + if b == nil { + return "BusinessGreetingMessage(nil)" + } + type Alias BusinessGreetingMessage + return fmt.Sprintf("BusinessGreetingMessage%+v", Alias(*b)) +} + +// FillFrom fills BusinessGreetingMessage from given interface. +func (b *BusinessGreetingMessage) FillFrom(from interface { + GetShortcutID() (value int) + GetRecipients() (value BusinessRecipients) + GetNoActivityDays() (value int) +}) { + b.ShortcutID = from.GetShortcutID() + b.Recipients = from.GetRecipients() + b.NoActivityDays = from.GetNoActivityDays() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessGreetingMessage) TypeID() uint32 { + return BusinessGreetingMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessGreetingMessage) TypeName() string { + return "businessGreetingMessage" +} + +// TypeInfo returns info about TL type. +func (b *BusinessGreetingMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessGreetingMessage", + ID: BusinessGreetingMessageTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + { + Name: "NoActivityDays", + SchemaName: "no_activity_days", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessGreetingMessage) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessGreetingMessage#e519abab as nil") + } + buf.PutID(BusinessGreetingMessageTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessGreetingMessage) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessGreetingMessage#e519abab as nil") + } + buf.PutInt(b.ShortcutID) + if err := b.Recipients.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessGreetingMessage#e519abab: field recipients: %w", err) + } + buf.PutInt(b.NoActivityDays) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessGreetingMessage) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessGreetingMessage#e519abab to nil") + } + if err := buf.ConsumeID(BusinessGreetingMessageTypeID); err != nil { + return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessGreetingMessage) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessGreetingMessage#e519abab to nil") + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: field shortcut_id: %w", err) + } + b.ShortcutID = value + } + { + if err := b.Recipients.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: field recipients: %w", err) + } + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: field no_activity_days: %w", err) + } + b.NoActivityDays = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (b *BusinessGreetingMessage) GetShortcutID() (value int) { + if b == nil { + return + } + return b.ShortcutID +} + +// GetRecipients returns value of Recipients field. +func (b *BusinessGreetingMessage) GetRecipients() (value BusinessRecipients) { + if b == nil { + return + } + return b.Recipients +} + +// GetNoActivityDays returns value of NoActivityDays field. +func (b *BusinessGreetingMessage) GetNoActivityDays() (value int) { + if b == nil { + return + } + return b.NoActivityDays +} diff --git a/tg/tl_business_greeting_message_slices_gen.go b/tg/tl_business_greeting_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_business_greeting_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_business_location_gen.go b/tg/tl_business_location_gen.go new file mode 100644 index 0000000000..2ca1f72647 --- /dev/null +++ b/tg/tl_business_location_gen.go @@ -0,0 +1,241 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessLocation represents TL type `businessLocation#ac5c1af7`. +// +// See https://core.telegram.org/constructor/businessLocation for reference. +type BusinessLocation struct { + // Flags field of BusinessLocation. + Flags bin.Fields + // GeoPoint field of BusinessLocation. + // + // Use SetGeoPoint and GetGeoPoint helpers. + GeoPoint GeoPointClass + // Address field of BusinessLocation. + Address string +} + +// BusinessLocationTypeID is TL type id of BusinessLocation. +const BusinessLocationTypeID = 0xac5c1af7 + +// Ensuring interfaces in compile-time for BusinessLocation. +var ( + _ bin.Encoder = &BusinessLocation{} + _ bin.Decoder = &BusinessLocation{} + _ bin.BareEncoder = &BusinessLocation{} + _ bin.BareDecoder = &BusinessLocation{} +) + +func (b *BusinessLocation) Zero() bool { + if b == nil { + return true + } + if !(b.Flags.Zero()) { + return false + } + if !(b.GeoPoint == nil) { + return false + } + if !(b.Address == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessLocation) String() string { + if b == nil { + return "BusinessLocation(nil)" + } + type Alias BusinessLocation + return fmt.Sprintf("BusinessLocation%+v", Alias(*b)) +} + +// FillFrom fills BusinessLocation from given interface. +func (b *BusinessLocation) FillFrom(from interface { + GetGeoPoint() (value GeoPointClass, ok bool) + GetAddress() (value string) +}) { + if val, ok := from.GetGeoPoint(); ok { + b.GeoPoint = val + } + + b.Address = from.GetAddress() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessLocation) TypeID() uint32 { + return BusinessLocationTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessLocation) TypeName() string { + return "businessLocation" +} + +// TypeInfo returns info about TL type. +func (b *BusinessLocation) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessLocation", + ID: BusinessLocationTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GeoPoint", + SchemaName: "geo_point", + Null: !b.Flags.Has(0), + }, + { + Name: "Address", + SchemaName: "address", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (b *BusinessLocation) SetFlags() { + if !(b.GeoPoint == nil) { + b.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (b *BusinessLocation) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessLocation#ac5c1af7 as nil") + } + buf.PutID(BusinessLocationTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessLocation) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessLocation#ac5c1af7 as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessLocation#ac5c1af7: field flags: %w", err) + } + if b.Flags.Has(0) { + if b.GeoPoint == nil { + return fmt.Errorf("unable to encode businessLocation#ac5c1af7: field geo_point is nil") + } + if err := b.GeoPoint.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessLocation#ac5c1af7: field geo_point: %w", err) + } + } + buf.PutString(b.Address) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessLocation) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessLocation#ac5c1af7 to nil") + } + if err := buf.ConsumeID(BusinessLocationTypeID); err != nil { + return fmt.Errorf("unable to decode businessLocation#ac5c1af7: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessLocation) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessLocation#ac5c1af7 to nil") + } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessLocation#ac5c1af7: field flags: %w", err) + } + } + if b.Flags.Has(0) { + value, err := DecodeGeoPoint(buf) + if err != nil { + return fmt.Errorf("unable to decode businessLocation#ac5c1af7: field geo_point: %w", err) + } + b.GeoPoint = value + } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode businessLocation#ac5c1af7: field address: %w", err) + } + b.Address = value + } + return nil +} + +// SetGeoPoint sets value of GeoPoint conditional field. +func (b *BusinessLocation) SetGeoPoint(value GeoPointClass) { + b.Flags.Set(0) + b.GeoPoint = value +} + +// GetGeoPoint returns value of GeoPoint conditional field and +// boolean which is true if field was set. +func (b *BusinessLocation) GetGeoPoint() (value GeoPointClass, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(0) { + return value, false + } + return b.GeoPoint, true +} + +// GetAddress returns value of Address field. +func (b *BusinessLocation) GetAddress() (value string) { + if b == nil { + return + } + return b.Address +} + +// GetGeoPointAsNotEmpty returns mapped value of GeoPoint conditional field and +// boolean which is true if field was set. +func (b *BusinessLocation) GetGeoPointAsNotEmpty() (*GeoPoint, bool) { + if value, ok := b.GetGeoPoint(); ok { + return value.AsNotEmpty() + } + return nil, false +} diff --git a/tg/tl_business_location_slices_gen.go b/tg/tl_business_location_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_business_location_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_business_recipients_gen.go b/tg/tl_business_recipients_gen.go new file mode 100644 index 0000000000..5dd11d456c --- /dev/null +++ b/tg/tl_business_recipients_gen.go @@ -0,0 +1,388 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessRecipients represents TL type `businessRecipients#21108ff7`. +// +// See https://core.telegram.org/constructor/businessRecipients for reference. +type BusinessRecipients struct { + // Flags field of BusinessRecipients. + Flags bin.Fields + // ExistingChats field of BusinessRecipients. + ExistingChats bool + // NewChats field of BusinessRecipients. + NewChats bool + // Contacts field of BusinessRecipients. + Contacts bool + // NonContacts field of BusinessRecipients. + NonContacts bool + // ExcludeSelected field of BusinessRecipients. + ExcludeSelected bool + // Users field of BusinessRecipients. + // + // Use SetUsers and GetUsers helpers. + Users []int64 +} + +// BusinessRecipientsTypeID is TL type id of BusinessRecipients. +const BusinessRecipientsTypeID = 0x21108ff7 + +// Ensuring interfaces in compile-time for BusinessRecipients. +var ( + _ bin.Encoder = &BusinessRecipients{} + _ bin.Decoder = &BusinessRecipients{} + _ bin.BareEncoder = &BusinessRecipients{} + _ bin.BareDecoder = &BusinessRecipients{} +) + +func (b *BusinessRecipients) Zero() bool { + if b == nil { + return true + } + if !(b.Flags.Zero()) { + return false + } + if !(b.ExistingChats == false) { + return false + } + if !(b.NewChats == false) { + return false + } + if !(b.Contacts == false) { + return false + } + if !(b.NonContacts == false) { + return false + } + if !(b.ExcludeSelected == false) { + return false + } + if !(b.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessRecipients) String() string { + if b == nil { + return "BusinessRecipients(nil)" + } + type Alias BusinessRecipients + return fmt.Sprintf("BusinessRecipients%+v", Alias(*b)) +} + +// FillFrom fills BusinessRecipients from given interface. +func (b *BusinessRecipients) FillFrom(from interface { + GetExistingChats() (value bool) + GetNewChats() (value bool) + GetContacts() (value bool) + GetNonContacts() (value bool) + GetExcludeSelected() (value bool) + GetUsers() (value []int64, ok bool) +}) { + b.ExistingChats = from.GetExistingChats() + b.NewChats = from.GetNewChats() + b.Contacts = from.GetContacts() + b.NonContacts = from.GetNonContacts() + b.ExcludeSelected = from.GetExcludeSelected() + if val, ok := from.GetUsers(); ok { + b.Users = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessRecipients) TypeID() uint32 { + return BusinessRecipientsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessRecipients) TypeName() string { + return "businessRecipients" +} + +// TypeInfo returns info about TL type. +func (b *BusinessRecipients) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessRecipients", + ID: BusinessRecipientsTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ExistingChats", + SchemaName: "existing_chats", + Null: !b.Flags.Has(0), + }, + { + Name: "NewChats", + SchemaName: "new_chats", + Null: !b.Flags.Has(1), + }, + { + Name: "Contacts", + SchemaName: "contacts", + Null: !b.Flags.Has(2), + }, + { + Name: "NonContacts", + SchemaName: "non_contacts", + Null: !b.Flags.Has(3), + }, + { + Name: "ExcludeSelected", + SchemaName: "exclude_selected", + Null: !b.Flags.Has(5), + }, + { + Name: "Users", + SchemaName: "users", + Null: !b.Flags.Has(4), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (b *BusinessRecipients) SetFlags() { + if !(b.ExistingChats == false) { + b.Flags.Set(0) + } + if !(b.NewChats == false) { + b.Flags.Set(1) + } + if !(b.Contacts == false) { + b.Flags.Set(2) + } + if !(b.NonContacts == false) { + b.Flags.Set(3) + } + if !(b.ExcludeSelected == false) { + b.Flags.Set(5) + } + if !(b.Users == nil) { + b.Flags.Set(4) + } +} + +// Encode implements bin.Encoder. +func (b *BusinessRecipients) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessRecipients#21108ff7 as nil") + } + buf.PutID(BusinessRecipientsTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessRecipients) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessRecipients#21108ff7 as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessRecipients#21108ff7: field flags: %w", err) + } + if b.Flags.Has(4) { + buf.PutVectorHeader(len(b.Users)) + for _, v := range b.Users { + buf.PutLong(v) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessRecipients) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessRecipients#21108ff7 to nil") + } + if err := buf.ConsumeID(BusinessRecipientsTypeID); err != nil { + return fmt.Errorf("unable to decode businessRecipients#21108ff7: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessRecipients) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessRecipients#21108ff7 to nil") + } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessRecipients#21108ff7: field flags: %w", err) + } + } + b.ExistingChats = b.Flags.Has(0) + b.NewChats = b.Flags.Has(1) + b.Contacts = b.Flags.Has(2) + b.NonContacts = b.Flags.Has(3) + b.ExcludeSelected = b.Flags.Has(5) + if b.Flags.Has(4) { + headerLen, err := buf.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#21108ff7: field users: %w", err) + } + + if headerLen > 0 { + b.Users = make([]int64, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := buf.Long() + if err != nil { + return fmt.Errorf("unable to decode businessRecipients#21108ff7: field users: %w", err) + } + b.Users = append(b.Users, value) + } + } + return nil +} + +// SetExistingChats sets value of ExistingChats conditional field. +func (b *BusinessRecipients) SetExistingChats(value bool) { + if value { + b.Flags.Set(0) + b.ExistingChats = true + } else { + b.Flags.Unset(0) + b.ExistingChats = false + } +} + +// GetExistingChats returns value of ExistingChats conditional field. +func (b *BusinessRecipients) GetExistingChats() (value bool) { + if b == nil { + return + } + return b.Flags.Has(0) +} + +// SetNewChats sets value of NewChats conditional field. +func (b *BusinessRecipients) SetNewChats(value bool) { + if value { + b.Flags.Set(1) + b.NewChats = true + } else { + b.Flags.Unset(1) + b.NewChats = false + } +} + +// GetNewChats returns value of NewChats conditional field. +func (b *BusinessRecipients) GetNewChats() (value bool) { + if b == nil { + return + } + return b.Flags.Has(1) +} + +// SetContacts sets value of Contacts conditional field. +func (b *BusinessRecipients) SetContacts(value bool) { + if value { + b.Flags.Set(2) + b.Contacts = true + } else { + b.Flags.Unset(2) + b.Contacts = false + } +} + +// GetContacts returns value of Contacts conditional field. +func (b *BusinessRecipients) GetContacts() (value bool) { + if b == nil { + return + } + return b.Flags.Has(2) +} + +// SetNonContacts sets value of NonContacts conditional field. +func (b *BusinessRecipients) SetNonContacts(value bool) { + if value { + b.Flags.Set(3) + b.NonContacts = true + } else { + b.Flags.Unset(3) + b.NonContacts = false + } +} + +// GetNonContacts returns value of NonContacts conditional field. +func (b *BusinessRecipients) GetNonContacts() (value bool) { + if b == nil { + return + } + return b.Flags.Has(3) +} + +// SetExcludeSelected sets value of ExcludeSelected conditional field. +func (b *BusinessRecipients) SetExcludeSelected(value bool) { + if value { + b.Flags.Set(5) + b.ExcludeSelected = true + } else { + b.Flags.Unset(5) + b.ExcludeSelected = false + } +} + +// GetExcludeSelected returns value of ExcludeSelected conditional field. +func (b *BusinessRecipients) GetExcludeSelected() (value bool) { + if b == nil { + return + } + return b.Flags.Has(5) +} + +// SetUsers sets value of Users conditional field. +func (b *BusinessRecipients) SetUsers(value []int64) { + b.Flags.Set(4) + b.Users = value +} + +// GetUsers returns value of Users conditional field and +// boolean which is true if field was set. +func (b *BusinessRecipients) GetUsers() (value []int64, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(4) { + return value, false + } + return b.Users, true +} diff --git a/tg/tl_business_recipients_slices_gen.go b/tg/tl_business_recipients_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_business_recipients_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_business_weekly_open_gen.go b/tg/tl_business_weekly_open_gen.go new file mode 100644 index 0000000000..adfd24a8a6 --- /dev/null +++ b/tg/tl_business_weekly_open_gen.go @@ -0,0 +1,188 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessWeeklyOpen represents TL type `businessWeeklyOpen#120b1ab9`. +// +// See https://core.telegram.org/constructor/businessWeeklyOpen for reference. +type BusinessWeeklyOpen struct { + // StartMinute field of BusinessWeeklyOpen. + StartMinute int + // EndMinute field of BusinessWeeklyOpen. + EndMinute int +} + +// BusinessWeeklyOpenTypeID is TL type id of BusinessWeeklyOpen. +const BusinessWeeklyOpenTypeID = 0x120b1ab9 + +// Ensuring interfaces in compile-time for BusinessWeeklyOpen. +var ( + _ bin.Encoder = &BusinessWeeklyOpen{} + _ bin.Decoder = &BusinessWeeklyOpen{} + _ bin.BareEncoder = &BusinessWeeklyOpen{} + _ bin.BareDecoder = &BusinessWeeklyOpen{} +) + +func (b *BusinessWeeklyOpen) Zero() bool { + if b == nil { + return true + } + if !(b.StartMinute == 0) { + return false + } + if !(b.EndMinute == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessWeeklyOpen) String() string { + if b == nil { + return "BusinessWeeklyOpen(nil)" + } + type Alias BusinessWeeklyOpen + return fmt.Sprintf("BusinessWeeklyOpen%+v", Alias(*b)) +} + +// FillFrom fills BusinessWeeklyOpen from given interface. +func (b *BusinessWeeklyOpen) FillFrom(from interface { + GetStartMinute() (value int) + GetEndMinute() (value int) +}) { + b.StartMinute = from.GetStartMinute() + b.EndMinute = from.GetEndMinute() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessWeeklyOpen) TypeID() uint32 { + return BusinessWeeklyOpenTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessWeeklyOpen) TypeName() string { + return "businessWeeklyOpen" +} + +// TypeInfo returns info about TL type. +func (b *BusinessWeeklyOpen) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessWeeklyOpen", + ID: BusinessWeeklyOpenTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StartMinute", + SchemaName: "start_minute", + }, + { + Name: "EndMinute", + SchemaName: "end_minute", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BusinessWeeklyOpen) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessWeeklyOpen#120b1ab9 as nil") + } + buf.PutID(BusinessWeeklyOpenTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessWeeklyOpen) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessWeeklyOpen#120b1ab9 as nil") + } + buf.PutInt(b.StartMinute) + buf.PutInt(b.EndMinute) + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessWeeklyOpen) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessWeeklyOpen#120b1ab9 to nil") + } + if err := buf.ConsumeID(BusinessWeeklyOpenTypeID); err != nil { + return fmt.Errorf("unable to decode businessWeeklyOpen#120b1ab9: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessWeeklyOpen) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessWeeklyOpen#120b1ab9 to nil") + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessWeeklyOpen#120b1ab9: field start_minute: %w", err) + } + b.StartMinute = value + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode businessWeeklyOpen#120b1ab9: field end_minute: %w", err) + } + b.EndMinute = value + } + return nil +} + +// GetStartMinute returns value of StartMinute field. +func (b *BusinessWeeklyOpen) GetStartMinute() (value int) { + if b == nil { + return + } + return b.StartMinute +} + +// GetEndMinute returns value of EndMinute field. +func (b *BusinessWeeklyOpen) GetEndMinute() (value int) { + if b == nil { + return + } + return b.EndMinute +} diff --git a/tg/tl_business_weekly_open_slices_gen.go b/tg/tl_business_weekly_open_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_business_weekly_open_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_business_work_hours_gen.go b/tg/tl_business_work_hours_gen.go new file mode 100644 index 0000000000..4cb1698f8e --- /dev/null +++ b/tg/tl_business_work_hours_gen.go @@ -0,0 +1,256 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BusinessWorkHours represents TL type `businessWorkHours#8c92b098`. +// +// See https://core.telegram.org/constructor/businessWorkHours for reference. +type BusinessWorkHours struct { + // Flags field of BusinessWorkHours. + Flags bin.Fields + // OpenNow field of BusinessWorkHours. + OpenNow bool + // TimezoneID field of BusinessWorkHours. + TimezoneID string + // WeeklyOpen field of BusinessWorkHours. + WeeklyOpen []BusinessWeeklyOpen +} + +// BusinessWorkHoursTypeID is TL type id of BusinessWorkHours. +const BusinessWorkHoursTypeID = 0x8c92b098 + +// Ensuring interfaces in compile-time for BusinessWorkHours. +var ( + _ bin.Encoder = &BusinessWorkHours{} + _ bin.Decoder = &BusinessWorkHours{} + _ bin.BareEncoder = &BusinessWorkHours{} + _ bin.BareDecoder = &BusinessWorkHours{} +) + +func (b *BusinessWorkHours) Zero() bool { + if b == nil { + return true + } + if !(b.Flags.Zero()) { + return false + } + if !(b.OpenNow == false) { + return false + } + if !(b.TimezoneID == "") { + return false + } + if !(b.WeeklyOpen == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BusinessWorkHours) String() string { + if b == nil { + return "BusinessWorkHours(nil)" + } + type Alias BusinessWorkHours + return fmt.Sprintf("BusinessWorkHours%+v", Alias(*b)) +} + +// FillFrom fills BusinessWorkHours from given interface. +func (b *BusinessWorkHours) FillFrom(from interface { + GetOpenNow() (value bool) + GetTimezoneID() (value string) + GetWeeklyOpen() (value []BusinessWeeklyOpen) +}) { + b.OpenNow = from.GetOpenNow() + b.TimezoneID = from.GetTimezoneID() + b.WeeklyOpen = from.GetWeeklyOpen() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BusinessWorkHours) TypeID() uint32 { + return BusinessWorkHoursTypeID +} + +// TypeName returns name of type in TL schema. +func (*BusinessWorkHours) TypeName() string { + return "businessWorkHours" +} + +// TypeInfo returns info about TL type. +func (b *BusinessWorkHours) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "businessWorkHours", + ID: BusinessWorkHoursTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OpenNow", + SchemaName: "open_now", + Null: !b.Flags.Has(0), + }, + { + Name: "TimezoneID", + SchemaName: "timezone_id", + }, + { + Name: "WeeklyOpen", + SchemaName: "weekly_open", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (b *BusinessWorkHours) SetFlags() { + if !(b.OpenNow == false) { + b.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (b *BusinessWorkHours) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessWorkHours#8c92b098 as nil") + } + buf.PutID(BusinessWorkHoursTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BusinessWorkHours) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode businessWorkHours#8c92b098 as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessWorkHours#8c92b098: field flags: %w", err) + } + buf.PutString(b.TimezoneID) + buf.PutVectorHeader(len(b.WeeklyOpen)) + for idx, v := range b.WeeklyOpen { + if err := v.Encode(buf); err != nil { + return fmt.Errorf("unable to encode businessWorkHours#8c92b098: field weekly_open element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BusinessWorkHours) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessWorkHours#8c92b098 to nil") + } + if err := buf.ConsumeID(BusinessWorkHoursTypeID); err != nil { + return fmt.Errorf("unable to decode businessWorkHours#8c92b098: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BusinessWorkHours) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode businessWorkHours#8c92b098 to nil") + } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessWorkHours#8c92b098: field flags: %w", err) + } + } + b.OpenNow = b.Flags.Has(0) + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode businessWorkHours#8c92b098: field timezone_id: %w", err) + } + b.TimezoneID = value + } + { + headerLen, err := buf.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode businessWorkHours#8c92b098: field weekly_open: %w", err) + } + + if headerLen > 0 { + b.WeeklyOpen = make([]BusinessWeeklyOpen, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value BusinessWeeklyOpen + if err := value.Decode(buf); err != nil { + return fmt.Errorf("unable to decode businessWorkHours#8c92b098: field weekly_open: %w", err) + } + b.WeeklyOpen = append(b.WeeklyOpen, value) + } + } + return nil +} + +// SetOpenNow sets value of OpenNow conditional field. +func (b *BusinessWorkHours) SetOpenNow(value bool) { + if value { + b.Flags.Set(0) + b.OpenNow = true + } else { + b.Flags.Unset(0) + b.OpenNow = false + } +} + +// GetOpenNow returns value of OpenNow conditional field. +func (b *BusinessWorkHours) GetOpenNow() (value bool) { + if b == nil { + return + } + return b.Flags.Has(0) +} + +// GetTimezoneID returns value of TimezoneID field. +func (b *BusinessWorkHours) GetTimezoneID() (value string) { + if b == nil { + return + } + return b.TimezoneID +} + +// GetWeeklyOpen returns value of WeeklyOpen field. +func (b *BusinessWorkHours) GetWeeklyOpen() (value []BusinessWeeklyOpen) { + if b == nil { + return + } + return b.WeeklyOpen +} diff --git a/tg/tl_business_work_hours_slices_gen.go b/tg/tl_business_work_hours_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_business_work_hours_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_connected_bot_gen.go b/tg/tl_connected_bot_gen.go new file mode 100644 index 0000000000..beb004547d --- /dev/null +++ b/tg/tl_connected_bot_gen.go @@ -0,0 +1,241 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ConnectedBot represents TL type `connectedBot#e7e999e7`. +// +// See https://core.telegram.org/constructor/connectedBot for reference. +type ConnectedBot struct { + // Flags field of ConnectedBot. + Flags bin.Fields + // CanReply field of ConnectedBot. + CanReply bool + // BotID field of ConnectedBot. + BotID int64 + // Recipients field of ConnectedBot. + Recipients BusinessRecipients +} + +// ConnectedBotTypeID is TL type id of ConnectedBot. +const ConnectedBotTypeID = 0xe7e999e7 + +// Ensuring interfaces in compile-time for ConnectedBot. +var ( + _ bin.Encoder = &ConnectedBot{} + _ bin.Decoder = &ConnectedBot{} + _ bin.BareEncoder = &ConnectedBot{} + _ bin.BareDecoder = &ConnectedBot{} +) + +func (c *ConnectedBot) Zero() bool { + if c == nil { + return true + } + if !(c.Flags.Zero()) { + return false + } + if !(c.CanReply == false) { + return false + } + if !(c.BotID == 0) { + return false + } + if !(c.Recipients.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ConnectedBot) String() string { + if c == nil { + return "ConnectedBot(nil)" + } + type Alias ConnectedBot + return fmt.Sprintf("ConnectedBot%+v", Alias(*c)) +} + +// FillFrom fills ConnectedBot from given interface. +func (c *ConnectedBot) FillFrom(from interface { + GetCanReply() (value bool) + GetBotID() (value int64) + GetRecipients() (value BusinessRecipients) +}) { + c.CanReply = from.GetCanReply() + c.BotID = from.GetBotID() + c.Recipients = from.GetRecipients() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ConnectedBot) TypeID() uint32 { + return ConnectedBotTypeID +} + +// TypeName returns name of type in TL schema. +func (*ConnectedBot) TypeName() string { + return "connectedBot" +} + +// TypeInfo returns info about TL type. +func (c *ConnectedBot) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "connectedBot", + ID: ConnectedBotTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CanReply", + SchemaName: "can_reply", + Null: !c.Flags.Has(0), + }, + { + Name: "BotID", + SchemaName: "bot_id", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (c *ConnectedBot) SetFlags() { + if !(c.CanReply == false) { + c.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (c *ConnectedBot) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode connectedBot#e7e999e7 as nil") + } + b.PutID(ConnectedBotTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ConnectedBot) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode connectedBot#e7e999e7 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode connectedBot#e7e999e7: field flags: %w", err) + } + b.PutLong(c.BotID) + if err := c.Recipients.Encode(b); err != nil { + return fmt.Errorf("unable to encode connectedBot#e7e999e7: field recipients: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ConnectedBot) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode connectedBot#e7e999e7 to nil") + } + if err := b.ConsumeID(ConnectedBotTypeID); err != nil { + return fmt.Errorf("unable to decode connectedBot#e7e999e7: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ConnectedBot) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode connectedBot#e7e999e7 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode connectedBot#e7e999e7: field flags: %w", err) + } + } + c.CanReply = c.Flags.Has(0) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode connectedBot#e7e999e7: field bot_id: %w", err) + } + c.BotID = value + } + { + if err := c.Recipients.Decode(b); err != nil { + return fmt.Errorf("unable to decode connectedBot#e7e999e7: field recipients: %w", err) + } + } + return nil +} + +// SetCanReply sets value of CanReply conditional field. +func (c *ConnectedBot) SetCanReply(value bool) { + if value { + c.Flags.Set(0) + c.CanReply = true + } else { + c.Flags.Unset(0) + c.CanReply = false + } +} + +// GetCanReply returns value of CanReply conditional field. +func (c *ConnectedBot) GetCanReply() (value bool) { + if c == nil { + return + } + return c.Flags.Has(0) +} + +// GetBotID returns value of BotID field. +func (c *ConnectedBot) GetBotID() (value int64) { + if c == nil { + return + } + return c.BotID +} + +// GetRecipients returns value of Recipients field. +func (c *ConnectedBot) GetRecipients() (value BusinessRecipients) { + if c == nil { + return + } + return c.Recipients +} diff --git a/tg/tl_connected_bot_slices_gen.go b/tg/tl_connected_bot_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_connected_bot_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_dialog_filter_class_vector_gen.go b/tg/tl_dialog_filter_class_vector_gen.go deleted file mode 100644 index 50c86706b9..0000000000 --- a/tg/tl_dialog_filter_class_vector_gen.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// DialogFilterClassVector is a box for Vector -type DialogFilterClassVector struct { - // Elements of Vector - Elems []DialogFilterClass -} - -// DialogFilterClassVectorTypeID is TL type id of DialogFilterClassVector. -const DialogFilterClassVectorTypeID = bin.TypeVector - -// Ensuring interfaces in compile-time for DialogFilterClassVector. -var ( - _ bin.Encoder = &DialogFilterClassVector{} - _ bin.Decoder = &DialogFilterClassVector{} - _ bin.BareEncoder = &DialogFilterClassVector{} - _ bin.BareDecoder = &DialogFilterClassVector{} -) - -func (vec *DialogFilterClassVector) Zero() bool { - if vec == nil { - return true - } - if !(vec.Elems == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (vec *DialogFilterClassVector) String() string { - if vec == nil { - return "DialogFilterClassVector(nil)" - } - type Alias DialogFilterClassVector - return fmt.Sprintf("DialogFilterClassVector%+v", Alias(*vec)) -} - -// FillFrom fills DialogFilterClassVector from given interface. -func (vec *DialogFilterClassVector) FillFrom(from interface { - GetElems() (value []DialogFilterClass) -}) { - vec.Elems = from.GetElems() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DialogFilterClassVector) TypeID() uint32 { - return DialogFilterClassVectorTypeID -} - -// TypeName returns name of type in TL schema. -func (*DialogFilterClassVector) TypeName() string { - return "" -} - -// TypeInfo returns info about TL type. -func (vec *DialogFilterClassVector) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "", - ID: DialogFilterClassVectorTypeID, - } - if vec == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Elems", - SchemaName: "Elems", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (vec *DialogFilterClassVector) Encode(b *bin.Buffer) error { - if vec == nil { - return fmt.Errorf("can't encode Vector as nil") - } - - return vec.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (vec *DialogFilterClassVector) EncodeBare(b *bin.Buffer) error { - if vec == nil { - return fmt.Errorf("can't encode Vector as nil") - } - b.PutVectorHeader(len(vec.Elems)) - for idx, v := range vec.Elems { - if v == nil { - return fmt.Errorf("unable to encode Vector: field Elems element with index %d is nil", idx) - } - if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode Vector: field Elems element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (vec *DialogFilterClassVector) Decode(b *bin.Buffer) error { - if vec == nil { - return fmt.Errorf("can't decode Vector to nil") - } - - return vec.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (vec *DialogFilterClassVector) DecodeBare(b *bin.Buffer) error { - if vec == nil { - return fmt.Errorf("can't decode Vector to nil") - } - { - headerLen, err := b.VectorHeader() - if err != nil { - return fmt.Errorf("unable to decode Vector: field Elems: %w", err) - } - - if headerLen > 0 { - vec.Elems = make([]DialogFilterClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeDialogFilter(b) - if err != nil { - return fmt.Errorf("unable to decode Vector: field Elems: %w", err) - } - vec.Elems = append(vec.Elems, value) - } - } - return nil -} - -// GetElems returns value of Elems field. -func (vec *DialogFilterClassVector) GetElems() (value []DialogFilterClass) { - if vec == nil { - return - } - return vec.Elems -} - -// MapElems returns field Elems wrapped in DialogFilterClassArray helper. -func (vec *DialogFilterClassVector) MapElems() (value DialogFilterClassArray) { - return DialogFilterClassArray(vec.Elems) -} diff --git a/tg/tl_dialog_filter_gen.go b/tg/tl_dialog_filter_gen.go index f39aad7f28..9e8703c0e6 100644 --- a/tg/tl_dialog_filter_gen.go +++ b/tg/tl_dialog_filter_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// DialogFilter represents TL type `dialogFilter#7438f7e8`. +// DialogFilter represents TL type `dialogFilter#5fb5523b`. // Dialog filter AKA folder¹ // // Links: @@ -98,6 +98,10 @@ type DialogFilter struct { // // Use SetEmoticon and GetEmoticon helpers. Emoticon string + // Color field of DialogFilter. + // + // Use SetColor and GetColor helpers. + Color int // Pinned chats, folders¹ can have unlimited pinned chats // // Links: @@ -116,7 +120,7 @@ type DialogFilter struct { } // DialogFilterTypeID is TL type id of DialogFilter. -const DialogFilterTypeID = 0x7438f7e8 +const DialogFilterTypeID = 0x5fb5523b // construct implements constructor of DialogFilterClass. func (d DialogFilter) construct() DialogFilterClass { return &d } @@ -171,6 +175,9 @@ func (d *DialogFilter) Zero() bool { if !(d.Emoticon == "") { return false } + if !(d.Color == 0) { + return false + } if !(d.PinnedPeers == nil) { return false } @@ -206,6 +213,7 @@ func (d *DialogFilter) FillFrom(from interface { GetID() (value int) GetTitle() (value string) GetEmoticon() (value string, ok bool) + GetColor() (value int, ok bool) GetPinnedPeers() (value []InputPeerClass) GetIncludePeers() (value []InputPeerClass) GetExcludePeers() (value []InputPeerClass) @@ -224,6 +232,10 @@ func (d *DialogFilter) FillFrom(from interface { d.Emoticon = val } + if val, ok := from.GetColor(); ok { + d.Color = val + } + d.PinnedPeers = from.GetPinnedPeers() d.IncludePeers = from.GetIncludePeers() d.ExcludePeers = from.GetExcludePeers() @@ -305,6 +317,11 @@ func (d *DialogFilter) TypeInfo() tdp.Type { SchemaName: "emoticon", Null: !d.Flags.Has(25), }, + { + Name: "Color", + SchemaName: "color", + Null: !d.Flags.Has(27), + }, { Name: "PinnedPeers", SchemaName: "pinned_peers", @@ -350,12 +367,15 @@ func (d *DialogFilter) SetFlags() { if !(d.Emoticon == "") { d.Flags.Set(25) } + if !(d.Color == 0) { + d.Flags.Set(27) + } } // Encode implements bin.Encoder. func (d *DialogFilter) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode dialogFilter#7438f7e8 as nil") + return fmt.Errorf("can't encode dialogFilter#5fb5523b as nil") } b.PutID(DialogFilterTypeID) return d.EncodeBare(b) @@ -364,42 +384,45 @@ func (d *DialogFilter) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *DialogFilter) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode dialogFilter#7438f7e8 as nil") + return fmt.Errorf("can't encode dialogFilter#5fb5523b as nil") } d.SetFlags() if err := d.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field flags: %w", err) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field flags: %w", err) } b.PutInt(d.ID) b.PutString(d.Title) if d.Flags.Has(25) { b.PutString(d.Emoticon) } + if d.Flags.Has(27) { + b.PutInt(d.Color) + } b.PutVectorHeader(len(d.PinnedPeers)) for idx, v := range d.PinnedPeers { if v == nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field pinned_peers element with index %d is nil", idx) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field pinned_peers element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field pinned_peers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field pinned_peers element with index %d: %w", idx, err) } } b.PutVectorHeader(len(d.IncludePeers)) for idx, v := range d.IncludePeers { if v == nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field include_peers element with index %d is nil", idx) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field include_peers element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field include_peers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field include_peers element with index %d: %w", idx, err) } } b.PutVectorHeader(len(d.ExcludePeers)) for idx, v := range d.ExcludePeers { if v == nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field exclude_peers element with index %d is nil", idx) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field exclude_peers element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilter#7438f7e8: field exclude_peers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode dialogFilter#5fb5523b: field exclude_peers element with index %d: %w", idx, err) } } return nil @@ -408,10 +431,10 @@ func (d *DialogFilter) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (d *DialogFilter) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode dialogFilter#7438f7e8 to nil") + return fmt.Errorf("can't decode dialogFilter#5fb5523b to nil") } if err := b.ConsumeID(DialogFilterTypeID); err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: %w", err) } return d.DecodeBare(b) } @@ -419,11 +442,11 @@ func (d *DialogFilter) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode dialogFilter#7438f7e8 to nil") + return fmt.Errorf("can't decode dialogFilter#5fb5523b to nil") } { if err := d.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field flags: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field flags: %w", err) } } d.Contacts = d.Flags.Has(0) @@ -437,28 +460,35 @@ func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field id: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field id: %w", err) } d.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field title: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field title: %w", err) } d.Title = value } if d.Flags.Has(25) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field emoticon: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field emoticon: %w", err) } d.Emoticon = value } + if d.Flags.Has(27) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field color: %w", err) + } + d.Color = value + } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field pinned_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field pinned_peers: %w", err) } if headerLen > 0 { @@ -467,7 +497,7 @@ func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field pinned_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field pinned_peers: %w", err) } d.PinnedPeers = append(d.PinnedPeers, value) } @@ -475,7 +505,7 @@ func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field include_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field include_peers: %w", err) } if headerLen > 0 { @@ -484,7 +514,7 @@ func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field include_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field include_peers: %w", err) } d.IncludePeers = append(d.IncludePeers, value) } @@ -492,7 +522,7 @@ func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field exclude_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field exclude_peers: %w", err) } if headerLen > 0 { @@ -501,7 +531,7 @@ func (d *DialogFilter) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode dialogFilter#7438f7e8: field exclude_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilter#5fb5523b: field exclude_peers: %w", err) } d.ExcludePeers = append(d.ExcludePeers, value) } @@ -695,6 +725,24 @@ func (d *DialogFilter) GetEmoticon() (value string, ok bool) { return d.Emoticon, true } +// SetColor sets value of Color conditional field. +func (d *DialogFilter) SetColor(value int) { + d.Flags.Set(27) + d.Color = value +} + +// GetColor returns value of Color conditional field and +// boolean which is true if field was set. +func (d *DialogFilter) GetColor() (value int, ok bool) { + if d == nil { + return + } + if !d.Flags.Has(27) { + return value, false + } + return d.Color, true +} + // GetPinnedPeers returns value of PinnedPeers field. func (d *DialogFilter) GetPinnedPeers() (value []InputPeerClass) { if d == nil { @@ -836,7 +884,7 @@ func (d *DialogFilterDefault) DecodeBare(b *bin.Buffer) error { return nil } -// DialogFilterChatlist represents TL type `dialogFilterChatlist#d64a04a8`. +// DialogFilterChatlist represents TL type `dialogFilterChatlist#9fe28ea4`. // A folder imported using a chat folder deep link »¹. // // Links: @@ -863,6 +911,10 @@ type DialogFilterChatlist struct { // // Use SetEmoticon and GetEmoticon helpers. Emoticon string + // Color field of DialogFilterChatlist. + // + // Use SetColor and GetColor helpers. + Color int // Pinned chats, folders¹ can have unlimited pinned chats // // Links: @@ -873,7 +925,7 @@ type DialogFilterChatlist struct { } // DialogFilterChatlistTypeID is TL type id of DialogFilterChatlist. -const DialogFilterChatlistTypeID = 0xd64a04a8 +const DialogFilterChatlistTypeID = 0x9fe28ea4 // construct implements constructor of DialogFilterClass. func (d DialogFilterChatlist) construct() DialogFilterClass { return &d } @@ -907,6 +959,9 @@ func (d *DialogFilterChatlist) Zero() bool { if !(d.Emoticon == "") { return false } + if !(d.Color == 0) { + return false + } if !(d.PinnedPeers == nil) { return false } @@ -932,6 +987,7 @@ func (d *DialogFilterChatlist) FillFrom(from interface { GetID() (value int) GetTitle() (value string) GetEmoticon() (value string, ok bool) + GetColor() (value int, ok bool) GetPinnedPeers() (value []InputPeerClass) GetIncludePeers() (value []InputPeerClass) }) { @@ -942,6 +998,10 @@ func (d *DialogFilterChatlist) FillFrom(from interface { d.Emoticon = val } + if val, ok := from.GetColor(); ok { + d.Color = val + } + d.PinnedPeers = from.GetPinnedPeers() d.IncludePeers = from.GetIncludePeers() } @@ -987,6 +1047,11 @@ func (d *DialogFilterChatlist) TypeInfo() tdp.Type { SchemaName: "emoticon", Null: !d.Flags.Has(25), }, + { + Name: "Color", + SchemaName: "color", + Null: !d.Flags.Has(27), + }, { Name: "PinnedPeers", SchemaName: "pinned_peers", @@ -1007,12 +1072,15 @@ func (d *DialogFilterChatlist) SetFlags() { if !(d.Emoticon == "") { d.Flags.Set(25) } + if !(d.Color == 0) { + d.Flags.Set(27) + } } // Encode implements bin.Encoder. func (d *DialogFilterChatlist) Encode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode dialogFilterChatlist#d64a04a8 as nil") + return fmt.Errorf("can't encode dialogFilterChatlist#9fe28ea4 as nil") } b.PutID(DialogFilterChatlistTypeID) return d.EncodeBare(b) @@ -1021,33 +1089,36 @@ func (d *DialogFilterChatlist) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (d *DialogFilterChatlist) EncodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't encode dialogFilterChatlist#d64a04a8 as nil") + return fmt.Errorf("can't encode dialogFilterChatlist#9fe28ea4 as nil") } d.SetFlags() if err := d.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilterChatlist#d64a04a8: field flags: %w", err) + return fmt.Errorf("unable to encode dialogFilterChatlist#9fe28ea4: field flags: %w", err) } b.PutInt(d.ID) b.PutString(d.Title) if d.Flags.Has(25) { b.PutString(d.Emoticon) } + if d.Flags.Has(27) { + b.PutInt(d.Color) + } b.PutVectorHeader(len(d.PinnedPeers)) for idx, v := range d.PinnedPeers { if v == nil { - return fmt.Errorf("unable to encode dialogFilterChatlist#d64a04a8: field pinned_peers element with index %d is nil", idx) + return fmt.Errorf("unable to encode dialogFilterChatlist#9fe28ea4: field pinned_peers element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilterChatlist#d64a04a8: field pinned_peers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode dialogFilterChatlist#9fe28ea4: field pinned_peers element with index %d: %w", idx, err) } } b.PutVectorHeader(len(d.IncludePeers)) for idx, v := range d.IncludePeers { if v == nil { - return fmt.Errorf("unable to encode dialogFilterChatlist#d64a04a8: field include_peers element with index %d is nil", idx) + return fmt.Errorf("unable to encode dialogFilterChatlist#9fe28ea4: field include_peers element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode dialogFilterChatlist#d64a04a8: field include_peers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode dialogFilterChatlist#9fe28ea4: field include_peers element with index %d: %w", idx, err) } } return nil @@ -1056,10 +1127,10 @@ func (d *DialogFilterChatlist) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (d *DialogFilterChatlist) Decode(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode dialogFilterChatlist#d64a04a8 to nil") + return fmt.Errorf("can't decode dialogFilterChatlist#9fe28ea4 to nil") } if err := b.ConsumeID(DialogFilterChatlistTypeID); err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: %w", err) } return d.DecodeBare(b) } @@ -1067,39 +1138,46 @@ func (d *DialogFilterChatlist) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (d *DialogFilterChatlist) DecodeBare(b *bin.Buffer) error { if d == nil { - return fmt.Errorf("can't decode dialogFilterChatlist#d64a04a8 to nil") + return fmt.Errorf("can't decode dialogFilterChatlist#9fe28ea4 to nil") } { if err := d.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field flags: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field flags: %w", err) } } d.HasMyInvites = d.Flags.Has(26) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field id: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field id: %w", err) } d.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field title: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field title: %w", err) } d.Title = value } if d.Flags.Has(25) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field emoticon: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field emoticon: %w", err) } d.Emoticon = value } + if d.Flags.Has(27) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field color: %w", err) + } + d.Color = value + } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field pinned_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field pinned_peers: %w", err) } if headerLen > 0 { @@ -1108,7 +1186,7 @@ func (d *DialogFilterChatlist) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field pinned_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field pinned_peers: %w", err) } d.PinnedPeers = append(d.PinnedPeers, value) } @@ -1116,7 +1194,7 @@ func (d *DialogFilterChatlist) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field include_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field include_peers: %w", err) } if headerLen > 0 { @@ -1125,7 +1203,7 @@ func (d *DialogFilterChatlist) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode dialogFilterChatlist#d64a04a8: field include_peers: %w", err) + return fmt.Errorf("unable to decode dialogFilterChatlist#9fe28ea4: field include_peers: %w", err) } d.IncludePeers = append(d.IncludePeers, value) } @@ -1186,6 +1264,24 @@ func (d *DialogFilterChatlist) GetEmoticon() (value string, ok bool) { return d.Emoticon, true } +// SetColor sets value of Color conditional field. +func (d *DialogFilterChatlist) SetColor(value int) { + d.Flags.Set(27) + d.Color = value +} + +// GetColor returns value of Color conditional field and +// boolean which is true if field was set. +func (d *DialogFilterChatlist) GetColor() (value int, ok bool) { + if d == nil { + return + } + if !d.Flags.Has(27) { + return value, false + } + return d.Color, true +} + // GetPinnedPeers returns value of PinnedPeers field. func (d *DialogFilterChatlist) GetPinnedPeers() (value []InputPeerClass) { if d == nil { @@ -1226,9 +1322,9 @@ const DialogFilterClassName = "DialogFilter" // panic(err) // } // switch v := g.(type) { -// case *tg.DialogFilter: // dialogFilter#7438f7e8 +// case *tg.DialogFilter: // dialogFilter#5fb5523b // case *tg.DialogFilterDefault: // dialogFilterDefault#363293ae -// case *tg.DialogFilterChatlist: // dialogFilterChatlist#d64a04a8 +// case *tg.DialogFilterChatlist: // dialogFilterChatlist#9fe28ea4 // default: panic(v) // } type DialogFilterClass interface { @@ -1266,7 +1362,7 @@ func DecodeDialogFilter(buf *bin.Buffer) (DialogFilterClass, error) { } switch id { case DialogFilterTypeID: - // Decoding dialogFilter#7438f7e8. + // Decoding dialogFilter#5fb5523b. v := DialogFilter{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode DialogFilterClass: %w", err) @@ -1280,7 +1376,7 @@ func DecodeDialogFilter(buf *bin.Buffer) (DialogFilterClass, error) { } return &v, nil case DialogFilterChatlistTypeID: - // Decoding dialogFilterChatlist#d64a04a8. + // Decoding dialogFilterChatlist#9fe28ea4. v := DialogFilterChatlist{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode DialogFilterClass: %w", err) diff --git a/tg/tl_handlers_gen.go b/tg/tl_handlers_gen.go index 6531d4001c..1f602cfd6f 100644 --- a/tg/tl_handlers_gen.go +++ b/tg/tl_handlers_gen.go @@ -1355,3 +1355,63 @@ func (u UpdateDispatcher) OnSavedReactionTags(handler SavedReactionTagsHandler) return handler(ctx, e, update.(*UpdateSavedReactionTags)) } } + +// SMSJobHandler is a SMSJob event handler. +type SMSJobHandler func(ctx context.Context, e Entities, update *UpdateSMSJob) error + +// OnSMSJob sets SMSJob handler. +func (u UpdateDispatcher) OnSMSJob(handler SMSJobHandler) { + u.handlers[UpdateSMSJobTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateSMSJob)) + } +} + +// QuickRepliesHandler is a QuickReplies event handler. +type QuickRepliesHandler func(ctx context.Context, e Entities, update *UpdateQuickReplies) error + +// OnQuickReplies sets QuickReplies handler. +func (u UpdateDispatcher) OnQuickReplies(handler QuickRepliesHandler) { + u.handlers[UpdateQuickRepliesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateQuickReplies)) + } +} + +// NewQuickReplyHandler is a NewQuickReply event handler. +type NewQuickReplyHandler func(ctx context.Context, e Entities, update *UpdateNewQuickReply) error + +// OnNewQuickReply sets NewQuickReply handler. +func (u UpdateDispatcher) OnNewQuickReply(handler NewQuickReplyHandler) { + u.handlers[UpdateNewQuickReplyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateNewQuickReply)) + } +} + +// DeleteQuickReplyHandler is a DeleteQuickReply event handler. +type DeleteQuickReplyHandler func(ctx context.Context, e Entities, update *UpdateDeleteQuickReply) error + +// OnDeleteQuickReply sets DeleteQuickReply handler. +func (u UpdateDispatcher) OnDeleteQuickReply(handler DeleteQuickReplyHandler) { + u.handlers[UpdateDeleteQuickReplyTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateDeleteQuickReply)) + } +} + +// QuickReplyMessageHandler is a QuickReplyMessage event handler. +type QuickReplyMessageHandler func(ctx context.Context, e Entities, update *UpdateQuickReplyMessage) error + +// OnQuickReplyMessage sets QuickReplyMessage handler. +func (u UpdateDispatcher) OnQuickReplyMessage(handler QuickReplyMessageHandler) { + u.handlers[UpdateQuickReplyMessageTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateQuickReplyMessage)) + } +} + +// DeleteQuickReplyMessagesHandler is a DeleteQuickReplyMessages event handler. +type DeleteQuickReplyMessagesHandler func(ctx context.Context, e Entities, update *UpdateDeleteQuickReplyMessages) error + +// OnDeleteQuickReplyMessages sets DeleteQuickReplyMessages handler. +func (u UpdateDispatcher) OnDeleteQuickReplyMessages(handler DeleteQuickReplyMessagesHandler) { + u.handlers[UpdateDeleteQuickReplyMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateDeleteQuickReplyMessages)) + } +} diff --git a/tg/tl_help_get_timezones_list_gen.go b/tg/tl_help_get_timezones_list_gen.go new file mode 100644 index 0000000000..e132ecdcd0 --- /dev/null +++ b/tg/tl_help_get_timezones_list_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// HelpGetTimezonesListRequest represents TL type `help.getTimezonesList#49b30240`. +// +// See https://core.telegram.org/method/help.getTimezonesList for reference. +type HelpGetTimezonesListRequest struct { + // Hash field of HelpGetTimezonesListRequest. + Hash int +} + +// HelpGetTimezonesListRequestTypeID is TL type id of HelpGetTimezonesListRequest. +const HelpGetTimezonesListRequestTypeID = 0x49b30240 + +// Ensuring interfaces in compile-time for HelpGetTimezonesListRequest. +var ( + _ bin.Encoder = &HelpGetTimezonesListRequest{} + _ bin.Decoder = &HelpGetTimezonesListRequest{} + _ bin.BareEncoder = &HelpGetTimezonesListRequest{} + _ bin.BareDecoder = &HelpGetTimezonesListRequest{} +) + +func (g *HelpGetTimezonesListRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *HelpGetTimezonesListRequest) String() string { + if g == nil { + return "HelpGetTimezonesListRequest(nil)" + } + type Alias HelpGetTimezonesListRequest + return fmt.Sprintf("HelpGetTimezonesListRequest%+v", Alias(*g)) +} + +// FillFrom fills HelpGetTimezonesListRequest from given interface. +func (g *HelpGetTimezonesListRequest) FillFrom(from interface { + GetHash() (value int) +}) { + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpGetTimezonesListRequest) TypeID() uint32 { + return HelpGetTimezonesListRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpGetTimezonesListRequest) TypeName() string { + return "help.getTimezonesList" +} + +// TypeInfo returns info about TL type. +func (g *HelpGetTimezonesListRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.getTimezonesList", + ID: HelpGetTimezonesListRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *HelpGetTimezonesListRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode help.getTimezonesList#49b30240 as nil") + } + b.PutID(HelpGetTimezonesListRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *HelpGetTimezonesListRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode help.getTimezonesList#49b30240 as nil") + } + b.PutInt(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *HelpGetTimezonesListRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode help.getTimezonesList#49b30240 to nil") + } + if err := b.ConsumeID(HelpGetTimezonesListRequestTypeID); err != nil { + return fmt.Errorf("unable to decode help.getTimezonesList#49b30240: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *HelpGetTimezonesListRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode help.getTimezonesList#49b30240 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.getTimezonesList#49b30240: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (g *HelpGetTimezonesListRequest) GetHash() (value int) { + if g == nil { + return + } + return g.Hash +} + +// HelpGetTimezonesList invokes method help.getTimezonesList#49b30240 returning error if any. +// +// See https://core.telegram.org/method/help.getTimezonesList for reference. +func (c *Client) HelpGetTimezonesList(ctx context.Context, hash int) (HelpTimezonesListClass, error) { + var result HelpTimezonesListBox + + request := &HelpGetTimezonesListRequest{ + Hash: hash, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.TimezonesList, nil +} diff --git a/tg/tl_help_get_timezones_list_slices_gen.go b/tg/tl_help_get_timezones_list_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_help_get_timezones_list_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_help_timezones_list_gen.go b/tg/tl_help_timezones_list_gen.go new file mode 100644 index 0000000000..0ccc7deb63 --- /dev/null +++ b/tg/tl_help_timezones_list_gen.go @@ -0,0 +1,411 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// HelpTimezonesListNotModified represents TL type `help.timezonesListNotModified#970708cc`. +// +// See https://core.telegram.org/constructor/help.timezonesListNotModified for reference. +type HelpTimezonesListNotModified struct { +} + +// HelpTimezonesListNotModifiedTypeID is TL type id of HelpTimezonesListNotModified. +const HelpTimezonesListNotModifiedTypeID = 0x970708cc + +// construct implements constructor of HelpTimezonesListClass. +func (t HelpTimezonesListNotModified) construct() HelpTimezonesListClass { return &t } + +// Ensuring interfaces in compile-time for HelpTimezonesListNotModified. +var ( + _ bin.Encoder = &HelpTimezonesListNotModified{} + _ bin.Decoder = &HelpTimezonesListNotModified{} + _ bin.BareEncoder = &HelpTimezonesListNotModified{} + _ bin.BareDecoder = &HelpTimezonesListNotModified{} + + _ HelpTimezonesListClass = &HelpTimezonesListNotModified{} +) + +func (t *HelpTimezonesListNotModified) Zero() bool { + if t == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (t *HelpTimezonesListNotModified) String() string { + if t == nil { + return "HelpTimezonesListNotModified(nil)" + } + type Alias HelpTimezonesListNotModified + return fmt.Sprintf("HelpTimezonesListNotModified%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpTimezonesListNotModified) TypeID() uint32 { + return HelpTimezonesListNotModifiedTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpTimezonesListNotModified) TypeName() string { + return "help.timezonesListNotModified" +} + +// TypeInfo returns info about TL type. +func (t *HelpTimezonesListNotModified) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.timezonesListNotModified", + ID: HelpTimezonesListNotModifiedTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (t *HelpTimezonesListNotModified) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode help.timezonesListNotModified#970708cc as nil") + } + b.PutID(HelpTimezonesListNotModifiedTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *HelpTimezonesListNotModified) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode help.timezonesListNotModified#970708cc as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (t *HelpTimezonesListNotModified) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode help.timezonesListNotModified#970708cc to nil") + } + if err := b.ConsumeID(HelpTimezonesListNotModifiedTypeID); err != nil { + return fmt.Errorf("unable to decode help.timezonesListNotModified#970708cc: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *HelpTimezonesListNotModified) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode help.timezonesListNotModified#970708cc to nil") + } + return nil +} + +// HelpTimezonesList represents TL type `help.timezonesList#7b74ed71`. +// +// See https://core.telegram.org/constructor/help.timezonesList for reference. +type HelpTimezonesList struct { + // Timezones field of HelpTimezonesList. + Timezones []Timezone + // Hash field of HelpTimezonesList. + Hash int +} + +// HelpTimezonesListTypeID is TL type id of HelpTimezonesList. +const HelpTimezonesListTypeID = 0x7b74ed71 + +// construct implements constructor of HelpTimezonesListClass. +func (t HelpTimezonesList) construct() HelpTimezonesListClass { return &t } + +// Ensuring interfaces in compile-time for HelpTimezonesList. +var ( + _ bin.Encoder = &HelpTimezonesList{} + _ bin.Decoder = &HelpTimezonesList{} + _ bin.BareEncoder = &HelpTimezonesList{} + _ bin.BareDecoder = &HelpTimezonesList{} + + _ HelpTimezonesListClass = &HelpTimezonesList{} +) + +func (t *HelpTimezonesList) Zero() bool { + if t == nil { + return true + } + if !(t.Timezones == nil) { + return false + } + if !(t.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *HelpTimezonesList) String() string { + if t == nil { + return "HelpTimezonesList(nil)" + } + type Alias HelpTimezonesList + return fmt.Sprintf("HelpTimezonesList%+v", Alias(*t)) +} + +// FillFrom fills HelpTimezonesList from given interface. +func (t *HelpTimezonesList) FillFrom(from interface { + GetTimezones() (value []Timezone) + GetHash() (value int) +}) { + t.Timezones = from.GetTimezones() + t.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpTimezonesList) TypeID() uint32 { + return HelpTimezonesListTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpTimezonesList) TypeName() string { + return "help.timezonesList" +} + +// TypeInfo returns info about TL type. +func (t *HelpTimezonesList) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.timezonesList", + ID: HelpTimezonesListTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Timezones", + SchemaName: "timezones", + }, + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *HelpTimezonesList) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode help.timezonesList#7b74ed71 as nil") + } + b.PutID(HelpTimezonesListTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *HelpTimezonesList) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode help.timezonesList#7b74ed71 as nil") + } + b.PutVectorHeader(len(t.Timezones)) + for idx, v := range t.Timezones { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode help.timezonesList#7b74ed71: field timezones element with index %d: %w", idx, err) + } + } + b.PutInt(t.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (t *HelpTimezonesList) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode help.timezonesList#7b74ed71 to nil") + } + if err := b.ConsumeID(HelpTimezonesListTypeID); err != nil { + return fmt.Errorf("unable to decode help.timezonesList#7b74ed71: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *HelpTimezonesList) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode help.timezonesList#7b74ed71 to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode help.timezonesList#7b74ed71: field timezones: %w", err) + } + + if headerLen > 0 { + t.Timezones = make([]Timezone, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value Timezone + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode help.timezonesList#7b74ed71: field timezones: %w", err) + } + t.Timezones = append(t.Timezones, value) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.timezonesList#7b74ed71: field hash: %w", err) + } + t.Hash = value + } + return nil +} + +// GetTimezones returns value of Timezones field. +func (t *HelpTimezonesList) GetTimezones() (value []Timezone) { + if t == nil { + return + } + return t.Timezones +} + +// GetHash returns value of Hash field. +func (t *HelpTimezonesList) GetHash() (value int) { + if t == nil { + return + } + return t.Hash +} + +// HelpTimezonesListClassName is schema name of HelpTimezonesListClass. +const HelpTimezonesListClassName = "help.TimezonesList" + +// HelpTimezonesListClass represents help.TimezonesList generic type. +// +// See https://core.telegram.org/type/help.TimezonesList for reference. +// +// Example: +// +// g, err := tg.DecodeHelpTimezonesList(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.HelpTimezonesListNotModified: // help.timezonesListNotModified#970708cc +// case *tg.HelpTimezonesList: // help.timezonesList#7b74ed71 +// default: panic(v) +// } +type HelpTimezonesListClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() HelpTimezonesListClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // AsModified tries to map HelpTimezonesListClass to HelpTimezonesList. + AsModified() (*HelpTimezonesList, bool) +} + +// AsModified tries to map HelpTimezonesListNotModified to HelpTimezonesList. +func (t *HelpTimezonesListNotModified) AsModified() (*HelpTimezonesList, bool) { + return nil, false +} + +// AsModified tries to map HelpTimezonesList to HelpTimezonesList. +func (t *HelpTimezonesList) AsModified() (*HelpTimezonesList, bool) { + return t, true +} + +// DecodeHelpTimezonesList implements binary de-serialization for HelpTimezonesListClass. +func DecodeHelpTimezonesList(buf *bin.Buffer) (HelpTimezonesListClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case HelpTimezonesListNotModifiedTypeID: + // Decoding help.timezonesListNotModified#970708cc. + v := HelpTimezonesListNotModified{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode HelpTimezonesListClass: %w", err) + } + return &v, nil + case HelpTimezonesListTypeID: + // Decoding help.timezonesList#7b74ed71. + v := HelpTimezonesList{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode HelpTimezonesListClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode HelpTimezonesListClass: %w", bin.NewUnexpectedID(id)) + } +} + +// HelpTimezonesList boxes the HelpTimezonesListClass providing a helper. +type HelpTimezonesListBox struct { + TimezonesList HelpTimezonesListClass +} + +// Decode implements bin.Decoder for HelpTimezonesListBox. +func (b *HelpTimezonesListBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode HelpTimezonesListBox to nil") + } + v, err := DecodeHelpTimezonesList(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.TimezonesList = v + return nil +} + +// Encode implements bin.Encode for HelpTimezonesListBox. +func (b *HelpTimezonesListBox) Encode(buf *bin.Buffer) error { + if b == nil || b.TimezonesList == nil { + return fmt.Errorf("unable to encode HelpTimezonesListClass as nil") + } + return b.TimezonesList.Encode(buf) +} diff --git a/tg/tl_help_timezones_list_slices_gen.go b/tg/tl_help_timezones_list_slices_gen.go new file mode 100644 index 0000000000..6cb42aed98 --- /dev/null +++ b/tg/tl_help_timezones_list_slices_gen.go @@ -0,0 +1,267 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// HelpTimezonesListClassArray is adapter for slice of HelpTimezonesListClass. +type HelpTimezonesListClassArray []HelpTimezonesListClass + +// Sort sorts slice of HelpTimezonesListClass. +func (s HelpTimezonesListClassArray) Sort(less func(a, b HelpTimezonesListClass) bool) HelpTimezonesListClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpTimezonesListClass. +func (s HelpTimezonesListClassArray) SortStable(less func(a, b HelpTimezonesListClass) bool) HelpTimezonesListClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpTimezonesListClass. +func (s HelpTimezonesListClassArray) Retain(keep func(x HelpTimezonesListClass) bool) HelpTimezonesListClassArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s HelpTimezonesListClassArray) First() (v HelpTimezonesListClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpTimezonesListClassArray) Last() (v HelpTimezonesListClass, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *HelpTimezonesListClassArray) PopFirst() (v HelpTimezonesListClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero HelpTimezonesListClass + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *HelpTimezonesListClassArray) Pop() (v HelpTimezonesListClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// AsHelpTimezonesList returns copy with only HelpTimezonesList constructors. +func (s HelpTimezonesListClassArray) AsHelpTimezonesList() (to HelpTimezonesListArray) { + for _, elem := range s { + value, ok := elem.(*HelpTimezonesList) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AppendOnlyModified appends only Modified constructors to +// given slice. +func (s HelpTimezonesListClassArray) AppendOnlyModified(to []*HelpTimezonesList) []*HelpTimezonesList { + for _, elem := range s { + value, ok := elem.AsModified() + if !ok { + continue + } + to = append(to, value) + } + + return to +} + +// AsModified returns copy with only Modified constructors. +func (s HelpTimezonesListClassArray) AsModified() (to []*HelpTimezonesList) { + return s.AppendOnlyModified(to) +} + +// FirstAsModified returns first element of slice (if exists). +func (s HelpTimezonesListClassArray) FirstAsModified() (v *HelpTimezonesList, ok bool) { + value, ok := s.First() + if !ok { + return + } + return value.AsModified() +} + +// LastAsModified returns last element of slice (if exists). +func (s HelpTimezonesListClassArray) LastAsModified() (v *HelpTimezonesList, ok bool) { + value, ok := s.Last() + if !ok { + return + } + return value.AsModified() +} + +// PopFirstAsModified returns element of slice (if exists). +func (s *HelpTimezonesListClassArray) PopFirstAsModified() (v *HelpTimezonesList, ok bool) { + value, ok := s.PopFirst() + if !ok { + return + } + return value.AsModified() +} + +// PopAsModified returns element of slice (if exists). +func (s *HelpTimezonesListClassArray) PopAsModified() (v *HelpTimezonesList, ok bool) { + value, ok := s.Pop() + if !ok { + return + } + return value.AsModified() +} + +// HelpTimezonesListArray is adapter for slice of HelpTimezonesList. +type HelpTimezonesListArray []HelpTimezonesList + +// Sort sorts slice of HelpTimezonesList. +func (s HelpTimezonesListArray) Sort(less func(a, b HelpTimezonesList) bool) HelpTimezonesListArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpTimezonesList. +func (s HelpTimezonesListArray) SortStable(less func(a, b HelpTimezonesList) bool) HelpTimezonesListArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpTimezonesList. +func (s HelpTimezonesListArray) Retain(keep func(x HelpTimezonesList) bool) HelpTimezonesListArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s HelpTimezonesListArray) First() (v HelpTimezonesList, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpTimezonesListArray) Last() (v HelpTimezonesList, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *HelpTimezonesListArray) PopFirst() (v HelpTimezonesList, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero HelpTimezonesList + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *HelpTimezonesListArray) Pop() (v HelpTimezonesList, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_input_business_away_message_gen.go b/tg/tl_input_business_away_message_gen.go new file mode 100644 index 0000000000..19a406449e --- /dev/null +++ b/tg/tl_input_business_away_message_gen.go @@ -0,0 +1,273 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// InputBusinessAwayMessage represents TL type `inputBusinessAwayMessage#832175e0`. +// +// See https://core.telegram.org/constructor/inputBusinessAwayMessage for reference. +type InputBusinessAwayMessage struct { + // Flags field of InputBusinessAwayMessage. + Flags bin.Fields + // OfflineOnly field of InputBusinessAwayMessage. + OfflineOnly bool + // ShortcutID field of InputBusinessAwayMessage. + ShortcutID int + // Schedule field of InputBusinessAwayMessage. + Schedule BusinessAwayMessageScheduleClass + // Recipients field of InputBusinessAwayMessage. + Recipients InputBusinessRecipients +} + +// InputBusinessAwayMessageTypeID is TL type id of InputBusinessAwayMessage. +const InputBusinessAwayMessageTypeID = 0x832175e0 + +// Ensuring interfaces in compile-time for InputBusinessAwayMessage. +var ( + _ bin.Encoder = &InputBusinessAwayMessage{} + _ bin.Decoder = &InputBusinessAwayMessage{} + _ bin.BareEncoder = &InputBusinessAwayMessage{} + _ bin.BareDecoder = &InputBusinessAwayMessage{} +) + +func (i *InputBusinessAwayMessage) Zero() bool { + if i == nil { + return true + } + if !(i.Flags.Zero()) { + return false + } + if !(i.OfflineOnly == false) { + return false + } + if !(i.ShortcutID == 0) { + return false + } + if !(i.Schedule == nil) { + return false + } + if !(i.Recipients.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputBusinessAwayMessage) String() string { + if i == nil { + return "InputBusinessAwayMessage(nil)" + } + type Alias InputBusinessAwayMessage + return fmt.Sprintf("InputBusinessAwayMessage%+v", Alias(*i)) +} + +// FillFrom fills InputBusinessAwayMessage from given interface. +func (i *InputBusinessAwayMessage) FillFrom(from interface { + GetOfflineOnly() (value bool) + GetShortcutID() (value int) + GetSchedule() (value BusinessAwayMessageScheduleClass) + GetRecipients() (value InputBusinessRecipients) +}) { + i.OfflineOnly = from.GetOfflineOnly() + i.ShortcutID = from.GetShortcutID() + i.Schedule = from.GetSchedule() + i.Recipients = from.GetRecipients() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputBusinessAwayMessage) TypeID() uint32 { + return InputBusinessAwayMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputBusinessAwayMessage) TypeName() string { + return "inputBusinessAwayMessage" +} + +// TypeInfo returns info about TL type. +func (i *InputBusinessAwayMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputBusinessAwayMessage", + ID: InputBusinessAwayMessageTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OfflineOnly", + SchemaName: "offline_only", + Null: !i.Flags.Has(0), + }, + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Schedule", + SchemaName: "schedule", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (i *InputBusinessAwayMessage) SetFlags() { + if !(i.OfflineOnly == false) { + i.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (i *InputBusinessAwayMessage) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputBusinessAwayMessage#832175e0 as nil") + } + b.PutID(InputBusinessAwayMessageTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputBusinessAwayMessage) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputBusinessAwayMessage#832175e0 as nil") + } + i.SetFlags() + if err := i.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputBusinessAwayMessage#832175e0: field flags: %w", err) + } + b.PutInt(i.ShortcutID) + if i.Schedule == nil { + return fmt.Errorf("unable to encode inputBusinessAwayMessage#832175e0: field schedule is nil") + } + if err := i.Schedule.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputBusinessAwayMessage#832175e0: field schedule: %w", err) + } + if err := i.Recipients.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputBusinessAwayMessage#832175e0: field recipients: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputBusinessAwayMessage) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputBusinessAwayMessage#832175e0 to nil") + } + if err := b.ConsumeID(InputBusinessAwayMessageTypeID); err != nil { + return fmt.Errorf("unable to decode inputBusinessAwayMessage#832175e0: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputBusinessAwayMessage) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputBusinessAwayMessage#832175e0 to nil") + } + { + if err := i.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputBusinessAwayMessage#832175e0: field flags: %w", err) + } + } + i.OfflineOnly = i.Flags.Has(0) + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputBusinessAwayMessage#832175e0: field shortcut_id: %w", err) + } + i.ShortcutID = value + } + { + value, err := DecodeBusinessAwayMessageSchedule(b) + if err != nil { + return fmt.Errorf("unable to decode inputBusinessAwayMessage#832175e0: field schedule: %w", err) + } + i.Schedule = value + } + { + if err := i.Recipients.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputBusinessAwayMessage#832175e0: field recipients: %w", err) + } + } + return nil +} + +// SetOfflineOnly sets value of OfflineOnly conditional field. +func (i *InputBusinessAwayMessage) SetOfflineOnly(value bool) { + if value { + i.Flags.Set(0) + i.OfflineOnly = true + } else { + i.Flags.Unset(0) + i.OfflineOnly = false + } +} + +// GetOfflineOnly returns value of OfflineOnly conditional field. +func (i *InputBusinessAwayMessage) GetOfflineOnly() (value bool) { + if i == nil { + return + } + return i.Flags.Has(0) +} + +// GetShortcutID returns value of ShortcutID field. +func (i *InputBusinessAwayMessage) GetShortcutID() (value int) { + if i == nil { + return + } + return i.ShortcutID +} + +// GetSchedule returns value of Schedule field. +func (i *InputBusinessAwayMessage) GetSchedule() (value BusinessAwayMessageScheduleClass) { + if i == nil { + return + } + return i.Schedule +} + +// GetRecipients returns value of Recipients field. +func (i *InputBusinessAwayMessage) GetRecipients() (value InputBusinessRecipients) { + if i == nil { + return + } + return i.Recipients +} diff --git a/tg/tl_input_business_away_message_slices_gen.go b/tg/tl_input_business_away_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_input_business_away_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_input_business_greeting_message_gen.go b/tg/tl_input_business_greeting_message_gen.go new file mode 100644 index 0000000000..3ffbfd411c --- /dev/null +++ b/tg/tl_input_business_greeting_message_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// InputBusinessGreetingMessage represents TL type `inputBusinessGreetingMessage#194cb3b`. +// +// See https://core.telegram.org/constructor/inputBusinessGreetingMessage for reference. +type InputBusinessGreetingMessage struct { + // ShortcutID field of InputBusinessGreetingMessage. + ShortcutID int + // Recipients field of InputBusinessGreetingMessage. + Recipients InputBusinessRecipients + // NoActivityDays field of InputBusinessGreetingMessage. + NoActivityDays int +} + +// InputBusinessGreetingMessageTypeID is TL type id of InputBusinessGreetingMessage. +const InputBusinessGreetingMessageTypeID = 0x194cb3b + +// Ensuring interfaces in compile-time for InputBusinessGreetingMessage. +var ( + _ bin.Encoder = &InputBusinessGreetingMessage{} + _ bin.Decoder = &InputBusinessGreetingMessage{} + _ bin.BareEncoder = &InputBusinessGreetingMessage{} + _ bin.BareDecoder = &InputBusinessGreetingMessage{} +) + +func (i *InputBusinessGreetingMessage) Zero() bool { + if i == nil { + return true + } + if !(i.ShortcutID == 0) { + return false + } + if !(i.Recipients.Zero()) { + return false + } + if !(i.NoActivityDays == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputBusinessGreetingMessage) String() string { + if i == nil { + return "InputBusinessGreetingMessage(nil)" + } + type Alias InputBusinessGreetingMessage + return fmt.Sprintf("InputBusinessGreetingMessage%+v", Alias(*i)) +} + +// FillFrom fills InputBusinessGreetingMessage from given interface. +func (i *InputBusinessGreetingMessage) FillFrom(from interface { + GetShortcutID() (value int) + GetRecipients() (value InputBusinessRecipients) + GetNoActivityDays() (value int) +}) { + i.ShortcutID = from.GetShortcutID() + i.Recipients = from.GetRecipients() + i.NoActivityDays = from.GetNoActivityDays() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputBusinessGreetingMessage) TypeID() uint32 { + return InputBusinessGreetingMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputBusinessGreetingMessage) TypeName() string { + return "inputBusinessGreetingMessage" +} + +// TypeInfo returns info about TL type. +func (i *InputBusinessGreetingMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputBusinessGreetingMessage", + ID: InputBusinessGreetingMessageTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Recipients", + SchemaName: "recipients", + }, + { + Name: "NoActivityDays", + SchemaName: "no_activity_days", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputBusinessGreetingMessage) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputBusinessGreetingMessage#194cb3b as nil") + } + b.PutID(InputBusinessGreetingMessageTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputBusinessGreetingMessage) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputBusinessGreetingMessage#194cb3b as nil") + } + b.PutInt(i.ShortcutID) + if err := i.Recipients.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputBusinessGreetingMessage#194cb3b: field recipients: %w", err) + } + b.PutInt(i.NoActivityDays) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputBusinessGreetingMessage) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputBusinessGreetingMessage#194cb3b to nil") + } + if err := b.ConsumeID(InputBusinessGreetingMessageTypeID); err != nil { + return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputBusinessGreetingMessage) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputBusinessGreetingMessage#194cb3b to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: field shortcut_id: %w", err) + } + i.ShortcutID = value + } + { + if err := i.Recipients.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: field recipients: %w", err) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: field no_activity_days: %w", err) + } + i.NoActivityDays = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (i *InputBusinessGreetingMessage) GetShortcutID() (value int) { + if i == nil { + return + } + return i.ShortcutID +} + +// GetRecipients returns value of Recipients field. +func (i *InputBusinessGreetingMessage) GetRecipients() (value InputBusinessRecipients) { + if i == nil { + return + } + return i.Recipients +} + +// GetNoActivityDays returns value of NoActivityDays field. +func (i *InputBusinessGreetingMessage) GetNoActivityDays() (value int) { + if i == nil { + return + } + return i.NoActivityDays +} diff --git a/tg/tl_input_business_greeting_message_slices_gen.go b/tg/tl_input_business_greeting_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_input_business_greeting_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_input_business_recipients_gen.go b/tg/tl_input_business_recipients_gen.go new file mode 100644 index 0000000000..d45849c63b --- /dev/null +++ b/tg/tl_input_business_recipients_gen.go @@ -0,0 +1,401 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// InputBusinessRecipients represents TL type `inputBusinessRecipients#6f8b32aa`. +// +// See https://core.telegram.org/constructor/inputBusinessRecipients for reference. +type InputBusinessRecipients struct { + // Flags field of InputBusinessRecipients. + Flags bin.Fields + // ExistingChats field of InputBusinessRecipients. + ExistingChats bool + // NewChats field of InputBusinessRecipients. + NewChats bool + // Contacts field of InputBusinessRecipients. + Contacts bool + // NonContacts field of InputBusinessRecipients. + NonContacts bool + // ExcludeSelected field of InputBusinessRecipients. + ExcludeSelected bool + // Users field of InputBusinessRecipients. + // + // Use SetUsers and GetUsers helpers. + Users []InputUserClass +} + +// InputBusinessRecipientsTypeID is TL type id of InputBusinessRecipients. +const InputBusinessRecipientsTypeID = 0x6f8b32aa + +// Ensuring interfaces in compile-time for InputBusinessRecipients. +var ( + _ bin.Encoder = &InputBusinessRecipients{} + _ bin.Decoder = &InputBusinessRecipients{} + _ bin.BareEncoder = &InputBusinessRecipients{} + _ bin.BareDecoder = &InputBusinessRecipients{} +) + +func (i *InputBusinessRecipients) Zero() bool { + if i == nil { + return true + } + if !(i.Flags.Zero()) { + return false + } + if !(i.ExistingChats == false) { + return false + } + if !(i.NewChats == false) { + return false + } + if !(i.Contacts == false) { + return false + } + if !(i.NonContacts == false) { + return false + } + if !(i.ExcludeSelected == false) { + return false + } + if !(i.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputBusinessRecipients) String() string { + if i == nil { + return "InputBusinessRecipients(nil)" + } + type Alias InputBusinessRecipients + return fmt.Sprintf("InputBusinessRecipients%+v", Alias(*i)) +} + +// FillFrom fills InputBusinessRecipients from given interface. +func (i *InputBusinessRecipients) FillFrom(from interface { + GetExistingChats() (value bool) + GetNewChats() (value bool) + GetContacts() (value bool) + GetNonContacts() (value bool) + GetExcludeSelected() (value bool) + GetUsers() (value []InputUserClass, ok bool) +}) { + i.ExistingChats = from.GetExistingChats() + i.NewChats = from.GetNewChats() + i.Contacts = from.GetContacts() + i.NonContacts = from.GetNonContacts() + i.ExcludeSelected = from.GetExcludeSelected() + if val, ok := from.GetUsers(); ok { + i.Users = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputBusinessRecipients) TypeID() uint32 { + return InputBusinessRecipientsTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputBusinessRecipients) TypeName() string { + return "inputBusinessRecipients" +} + +// TypeInfo returns info about TL type. +func (i *InputBusinessRecipients) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputBusinessRecipients", + ID: InputBusinessRecipientsTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ExistingChats", + SchemaName: "existing_chats", + Null: !i.Flags.Has(0), + }, + { + Name: "NewChats", + SchemaName: "new_chats", + Null: !i.Flags.Has(1), + }, + { + Name: "Contacts", + SchemaName: "contacts", + Null: !i.Flags.Has(2), + }, + { + Name: "NonContacts", + SchemaName: "non_contacts", + Null: !i.Flags.Has(3), + }, + { + Name: "ExcludeSelected", + SchemaName: "exclude_selected", + Null: !i.Flags.Has(5), + }, + { + Name: "Users", + SchemaName: "users", + Null: !i.Flags.Has(4), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (i *InputBusinessRecipients) SetFlags() { + if !(i.ExistingChats == false) { + i.Flags.Set(0) + } + if !(i.NewChats == false) { + i.Flags.Set(1) + } + if !(i.Contacts == false) { + i.Flags.Set(2) + } + if !(i.NonContacts == false) { + i.Flags.Set(3) + } + if !(i.ExcludeSelected == false) { + i.Flags.Set(5) + } + if !(i.Users == nil) { + i.Flags.Set(4) + } +} + +// Encode implements bin.Encoder. +func (i *InputBusinessRecipients) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputBusinessRecipients#6f8b32aa as nil") + } + b.PutID(InputBusinessRecipientsTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputBusinessRecipients) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputBusinessRecipients#6f8b32aa as nil") + } + i.SetFlags() + if err := i.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputBusinessRecipients#6f8b32aa: field flags: %w", err) + } + if i.Flags.Has(4) { + b.PutVectorHeader(len(i.Users)) + for idx, v := range i.Users { + if v == nil { + return fmt.Errorf("unable to encode inputBusinessRecipients#6f8b32aa: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputBusinessRecipients#6f8b32aa: field users element with index %d: %w", idx, err) + } + } + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputBusinessRecipients) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputBusinessRecipients#6f8b32aa to nil") + } + if err := b.ConsumeID(InputBusinessRecipientsTypeID); err != nil { + return fmt.Errorf("unable to decode inputBusinessRecipients#6f8b32aa: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputBusinessRecipients) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputBusinessRecipients#6f8b32aa to nil") + } + { + if err := i.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputBusinessRecipients#6f8b32aa: field flags: %w", err) + } + } + i.ExistingChats = i.Flags.Has(0) + i.NewChats = i.Flags.Has(1) + i.Contacts = i.Flags.Has(2) + i.NonContacts = i.Flags.Has(3) + i.ExcludeSelected = i.Flags.Has(5) + if i.Flags.Has(4) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode inputBusinessRecipients#6f8b32aa: field users: %w", err) + } + + if headerLen > 0 { + i.Users = make([]InputUserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode inputBusinessRecipients#6f8b32aa: field users: %w", err) + } + i.Users = append(i.Users, value) + } + } + return nil +} + +// SetExistingChats sets value of ExistingChats conditional field. +func (i *InputBusinessRecipients) SetExistingChats(value bool) { + if value { + i.Flags.Set(0) + i.ExistingChats = true + } else { + i.Flags.Unset(0) + i.ExistingChats = false + } +} + +// GetExistingChats returns value of ExistingChats conditional field. +func (i *InputBusinessRecipients) GetExistingChats() (value bool) { + if i == nil { + return + } + return i.Flags.Has(0) +} + +// SetNewChats sets value of NewChats conditional field. +func (i *InputBusinessRecipients) SetNewChats(value bool) { + if value { + i.Flags.Set(1) + i.NewChats = true + } else { + i.Flags.Unset(1) + i.NewChats = false + } +} + +// GetNewChats returns value of NewChats conditional field. +func (i *InputBusinessRecipients) GetNewChats() (value bool) { + if i == nil { + return + } + return i.Flags.Has(1) +} + +// SetContacts sets value of Contacts conditional field. +func (i *InputBusinessRecipients) SetContacts(value bool) { + if value { + i.Flags.Set(2) + i.Contacts = true + } else { + i.Flags.Unset(2) + i.Contacts = false + } +} + +// GetContacts returns value of Contacts conditional field. +func (i *InputBusinessRecipients) GetContacts() (value bool) { + if i == nil { + return + } + return i.Flags.Has(2) +} + +// SetNonContacts sets value of NonContacts conditional field. +func (i *InputBusinessRecipients) SetNonContacts(value bool) { + if value { + i.Flags.Set(3) + i.NonContacts = true + } else { + i.Flags.Unset(3) + i.NonContacts = false + } +} + +// GetNonContacts returns value of NonContacts conditional field. +func (i *InputBusinessRecipients) GetNonContacts() (value bool) { + if i == nil { + return + } + return i.Flags.Has(3) +} + +// SetExcludeSelected sets value of ExcludeSelected conditional field. +func (i *InputBusinessRecipients) SetExcludeSelected(value bool) { + if value { + i.Flags.Set(5) + i.ExcludeSelected = true + } else { + i.Flags.Unset(5) + i.ExcludeSelected = false + } +} + +// GetExcludeSelected returns value of ExcludeSelected conditional field. +func (i *InputBusinessRecipients) GetExcludeSelected() (value bool) { + if i == nil { + return + } + return i.Flags.Has(5) +} + +// SetUsers sets value of Users conditional field. +func (i *InputBusinessRecipients) SetUsers(value []InputUserClass) { + i.Flags.Set(4) + i.Users = value +} + +// GetUsers returns value of Users conditional field and +// boolean which is true if field was set. +func (i *InputBusinessRecipients) GetUsers() (value []InputUserClass, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(4) { + return value, false + } + return i.Users, true +} + +// MapUsers returns field Users wrapped in InputUserClassArray helper. +func (i *InputBusinessRecipients) MapUsers() (value InputUserClassArray, ok bool) { + if !i.Flags.Has(4) { + return value, false + } + return InputUserClassArray(i.Users), true +} diff --git a/tg/tl_input_business_recipients_slices_gen.go b/tg/tl_input_business_recipients_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_input_business_recipients_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_input_quick_reply_shortcut_gen.go b/tg/tl_input_quick_reply_shortcut_gen.go new file mode 100644 index 0000000000..9b5ca13df3 --- /dev/null +++ b/tg/tl_input_quick_reply_shortcut_gen.go @@ -0,0 +1,389 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// InputQuickReplyShortcut represents TL type `inputQuickReplyShortcut#24596d41`. +// +// See https://core.telegram.org/constructor/inputQuickReplyShortcut for reference. +type InputQuickReplyShortcut struct { + // Shortcut field of InputQuickReplyShortcut. + Shortcut string +} + +// InputQuickReplyShortcutTypeID is TL type id of InputQuickReplyShortcut. +const InputQuickReplyShortcutTypeID = 0x24596d41 + +// construct implements constructor of InputQuickReplyShortcutClass. +func (i InputQuickReplyShortcut) construct() InputQuickReplyShortcutClass { return &i } + +// Ensuring interfaces in compile-time for InputQuickReplyShortcut. +var ( + _ bin.Encoder = &InputQuickReplyShortcut{} + _ bin.Decoder = &InputQuickReplyShortcut{} + _ bin.BareEncoder = &InputQuickReplyShortcut{} + _ bin.BareDecoder = &InputQuickReplyShortcut{} + + _ InputQuickReplyShortcutClass = &InputQuickReplyShortcut{} +) + +func (i *InputQuickReplyShortcut) Zero() bool { + if i == nil { + return true + } + if !(i.Shortcut == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputQuickReplyShortcut) String() string { + if i == nil { + return "InputQuickReplyShortcut(nil)" + } + type Alias InputQuickReplyShortcut + return fmt.Sprintf("InputQuickReplyShortcut%+v", Alias(*i)) +} + +// FillFrom fills InputQuickReplyShortcut from given interface. +func (i *InputQuickReplyShortcut) FillFrom(from interface { + GetShortcut() (value string) +}) { + i.Shortcut = from.GetShortcut() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputQuickReplyShortcut) TypeID() uint32 { + return InputQuickReplyShortcutTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputQuickReplyShortcut) TypeName() string { + return "inputQuickReplyShortcut" +} + +// TypeInfo returns info about TL type. +func (i *InputQuickReplyShortcut) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputQuickReplyShortcut", + ID: InputQuickReplyShortcutTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Shortcut", + SchemaName: "shortcut", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputQuickReplyShortcut) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputQuickReplyShortcut#24596d41 as nil") + } + b.PutID(InputQuickReplyShortcutTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputQuickReplyShortcut) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputQuickReplyShortcut#24596d41 as nil") + } + b.PutString(i.Shortcut) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputQuickReplyShortcut) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputQuickReplyShortcut#24596d41 to nil") + } + if err := b.ConsumeID(InputQuickReplyShortcutTypeID); err != nil { + return fmt.Errorf("unable to decode inputQuickReplyShortcut#24596d41: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputQuickReplyShortcut) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputQuickReplyShortcut#24596d41 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputQuickReplyShortcut#24596d41: field shortcut: %w", err) + } + i.Shortcut = value + } + return nil +} + +// GetShortcut returns value of Shortcut field. +func (i *InputQuickReplyShortcut) GetShortcut() (value string) { + if i == nil { + return + } + return i.Shortcut +} + +// InputQuickReplyShortcutID represents TL type `inputQuickReplyShortcutId#1190cf1`. +// +// See https://core.telegram.org/constructor/inputQuickReplyShortcutId for reference. +type InputQuickReplyShortcutID struct { + // ShortcutID field of InputQuickReplyShortcutID. + ShortcutID int +} + +// InputQuickReplyShortcutIDTypeID is TL type id of InputQuickReplyShortcutID. +const InputQuickReplyShortcutIDTypeID = 0x1190cf1 + +// construct implements constructor of InputQuickReplyShortcutClass. +func (i InputQuickReplyShortcutID) construct() InputQuickReplyShortcutClass { return &i } + +// Ensuring interfaces in compile-time for InputQuickReplyShortcutID. +var ( + _ bin.Encoder = &InputQuickReplyShortcutID{} + _ bin.Decoder = &InputQuickReplyShortcutID{} + _ bin.BareEncoder = &InputQuickReplyShortcutID{} + _ bin.BareDecoder = &InputQuickReplyShortcutID{} + + _ InputQuickReplyShortcutClass = &InputQuickReplyShortcutID{} +) + +func (i *InputQuickReplyShortcutID) Zero() bool { + if i == nil { + return true + } + if !(i.ShortcutID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputQuickReplyShortcutID) String() string { + if i == nil { + return "InputQuickReplyShortcutID(nil)" + } + type Alias InputQuickReplyShortcutID + return fmt.Sprintf("InputQuickReplyShortcutID%+v", Alias(*i)) +} + +// FillFrom fills InputQuickReplyShortcutID from given interface. +func (i *InputQuickReplyShortcutID) FillFrom(from interface { + GetShortcutID() (value int) +}) { + i.ShortcutID = from.GetShortcutID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputQuickReplyShortcutID) TypeID() uint32 { + return InputQuickReplyShortcutIDTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputQuickReplyShortcutID) TypeName() string { + return "inputQuickReplyShortcutId" +} + +// TypeInfo returns info about TL type. +func (i *InputQuickReplyShortcutID) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputQuickReplyShortcutId", + ID: InputQuickReplyShortcutIDTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputQuickReplyShortcutID) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputQuickReplyShortcutId#1190cf1 as nil") + } + b.PutID(InputQuickReplyShortcutIDTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputQuickReplyShortcutID) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputQuickReplyShortcutId#1190cf1 as nil") + } + b.PutInt(i.ShortcutID) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputQuickReplyShortcutID) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputQuickReplyShortcutId#1190cf1 to nil") + } + if err := b.ConsumeID(InputQuickReplyShortcutIDTypeID); err != nil { + return fmt.Errorf("unable to decode inputQuickReplyShortcutId#1190cf1: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputQuickReplyShortcutID) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputQuickReplyShortcutId#1190cf1 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputQuickReplyShortcutId#1190cf1: field shortcut_id: %w", err) + } + i.ShortcutID = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (i *InputQuickReplyShortcutID) GetShortcutID() (value int) { + if i == nil { + return + } + return i.ShortcutID +} + +// InputQuickReplyShortcutClassName is schema name of InputQuickReplyShortcutClass. +const InputQuickReplyShortcutClassName = "InputQuickReplyShortcut" + +// InputQuickReplyShortcutClass represents InputQuickReplyShortcut generic type. +// +// See https://core.telegram.org/type/InputQuickReplyShortcut for reference. +// +// Example: +// +// g, err := tg.DecodeInputQuickReplyShortcut(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.InputQuickReplyShortcut: // inputQuickReplyShortcut#24596d41 +// case *tg.InputQuickReplyShortcutID: // inputQuickReplyShortcutId#1190cf1 +// default: panic(v) +// } +type InputQuickReplyShortcutClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() InputQuickReplyShortcutClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool +} + +// DecodeInputQuickReplyShortcut implements binary de-serialization for InputQuickReplyShortcutClass. +func DecodeInputQuickReplyShortcut(buf *bin.Buffer) (InputQuickReplyShortcutClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case InputQuickReplyShortcutTypeID: + // Decoding inputQuickReplyShortcut#24596d41. + v := InputQuickReplyShortcut{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputQuickReplyShortcutClass: %w", err) + } + return &v, nil + case InputQuickReplyShortcutIDTypeID: + // Decoding inputQuickReplyShortcutId#1190cf1. + v := InputQuickReplyShortcutID{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputQuickReplyShortcutClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode InputQuickReplyShortcutClass: %w", bin.NewUnexpectedID(id)) + } +} + +// InputQuickReplyShortcut boxes the InputQuickReplyShortcutClass providing a helper. +type InputQuickReplyShortcutBox struct { + InputQuickReplyShortcut InputQuickReplyShortcutClass +} + +// Decode implements bin.Decoder for InputQuickReplyShortcutBox. +func (b *InputQuickReplyShortcutBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode InputQuickReplyShortcutBox to nil") + } + v, err := DecodeInputQuickReplyShortcut(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.InputQuickReplyShortcut = v + return nil +} + +// Encode implements bin.Encode for InputQuickReplyShortcutBox. +func (b *InputQuickReplyShortcutBox) Encode(buf *bin.Buffer) error { + if b == nil || b.InputQuickReplyShortcut == nil { + return fmt.Errorf("unable to encode InputQuickReplyShortcutClass as nil") + } + return b.InputQuickReplyShortcut.Encode(buf) +} diff --git a/tg/tl_input_quick_reply_shortcut_slices_gen.go b/tg/tl_input_quick_reply_shortcut_slices_gen.go new file mode 100644 index 0000000000..edca46f512 --- /dev/null +++ b/tg/tl_input_quick_reply_shortcut_slices_gen.go @@ -0,0 +1,307 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// InputQuickReplyShortcutClassArray is adapter for slice of InputQuickReplyShortcutClass. +type InputQuickReplyShortcutClassArray []InputQuickReplyShortcutClass + +// Sort sorts slice of InputQuickReplyShortcutClass. +func (s InputQuickReplyShortcutClassArray) Sort(less func(a, b InputQuickReplyShortcutClass) bool) InputQuickReplyShortcutClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputQuickReplyShortcutClass. +func (s InputQuickReplyShortcutClassArray) SortStable(less func(a, b InputQuickReplyShortcutClass) bool) InputQuickReplyShortcutClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputQuickReplyShortcutClass. +func (s InputQuickReplyShortcutClassArray) Retain(keep func(x InputQuickReplyShortcutClass) bool) InputQuickReplyShortcutClassArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputQuickReplyShortcutClassArray) First() (v InputQuickReplyShortcutClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputQuickReplyShortcutClassArray) Last() (v InputQuickReplyShortcutClass, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputQuickReplyShortcutClassArray) PopFirst() (v InputQuickReplyShortcutClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputQuickReplyShortcutClass + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputQuickReplyShortcutClassArray) Pop() (v InputQuickReplyShortcutClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// AsInputQuickReplyShortcut returns copy with only InputQuickReplyShortcut constructors. +func (s InputQuickReplyShortcutClassArray) AsInputQuickReplyShortcut() (to InputQuickReplyShortcutArray) { + for _, elem := range s { + value, ok := elem.(*InputQuickReplyShortcut) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsInputQuickReplyShortcutID returns copy with only InputQuickReplyShortcutID constructors. +func (s InputQuickReplyShortcutClassArray) AsInputQuickReplyShortcutID() (to InputQuickReplyShortcutIDArray) { + for _, elem := range s { + value, ok := elem.(*InputQuickReplyShortcutID) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// InputQuickReplyShortcutArray is adapter for slice of InputQuickReplyShortcut. +type InputQuickReplyShortcutArray []InputQuickReplyShortcut + +// Sort sorts slice of InputQuickReplyShortcut. +func (s InputQuickReplyShortcutArray) Sort(less func(a, b InputQuickReplyShortcut) bool) InputQuickReplyShortcutArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputQuickReplyShortcut. +func (s InputQuickReplyShortcutArray) SortStable(less func(a, b InputQuickReplyShortcut) bool) InputQuickReplyShortcutArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputQuickReplyShortcut. +func (s InputQuickReplyShortcutArray) Retain(keep func(x InputQuickReplyShortcut) bool) InputQuickReplyShortcutArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputQuickReplyShortcutArray) First() (v InputQuickReplyShortcut, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputQuickReplyShortcutArray) Last() (v InputQuickReplyShortcut, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputQuickReplyShortcutArray) PopFirst() (v InputQuickReplyShortcut, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputQuickReplyShortcut + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputQuickReplyShortcutArray) Pop() (v InputQuickReplyShortcut, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// InputQuickReplyShortcutIDArray is adapter for slice of InputQuickReplyShortcutID. +type InputQuickReplyShortcutIDArray []InputQuickReplyShortcutID + +// Sort sorts slice of InputQuickReplyShortcutID. +func (s InputQuickReplyShortcutIDArray) Sort(less func(a, b InputQuickReplyShortcutID) bool) InputQuickReplyShortcutIDArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputQuickReplyShortcutID. +func (s InputQuickReplyShortcutIDArray) SortStable(less func(a, b InputQuickReplyShortcutID) bool) InputQuickReplyShortcutIDArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputQuickReplyShortcutID. +func (s InputQuickReplyShortcutIDArray) Retain(keep func(x InputQuickReplyShortcutID) bool) InputQuickReplyShortcutIDArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s InputQuickReplyShortcutIDArray) First() (v InputQuickReplyShortcutID, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputQuickReplyShortcutIDArray) Last() (v InputQuickReplyShortcutID, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *InputQuickReplyShortcutIDArray) PopFirst() (v InputQuickReplyShortcutID, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero InputQuickReplyShortcutID + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *InputQuickReplyShortcutIDArray) Pop() (v InputQuickReplyShortcutID, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_message_gen.go b/tg/tl_message_gen.go index c748280ed9..b0e7c9c0d2 100644 --- a/tg/tl_message_gen.go +++ b/tg/tl_message_gen.go @@ -240,7 +240,7 @@ func (m *MessageEmpty) GetPeerID() (value PeerClass, ok bool) { return m.PeerID, true } -// Message represents TL type `message#1e4c8a69`. +// Message represents TL type `message#a66c7efc`. // A message // // See https://core.telegram.org/constructor/message for reference. @@ -385,10 +385,14 @@ type Message struct { // // Use SetTTLPeriod and GetTTLPeriod helpers. TTLPeriod int + // QuickReplyShortcutID field of Message. + // + // Use SetQuickReplyShortcutID and GetQuickReplyShortcutID helpers. + QuickReplyShortcutID int } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0x1e4c8a69 +const MessageTypeID = 0xa66c7efc // construct implements constructor of MessageClass. func (m Message) construct() MessageClass { return &m } @@ -509,6 +513,9 @@ func (m *Message) Zero() bool { if !(m.TTLPeriod == 0) { return false } + if !(m.QuickReplyShortcutID == 0) { + return false + } return true } @@ -557,6 +564,7 @@ func (m *Message) FillFrom(from interface { GetReactions() (value MessageReactions, ok bool) GetRestrictionReason() (value []RestrictionReason, ok bool) GetTTLPeriod() (value int, ok bool) + GetQuickReplyShortcutID() (value int, ok bool) }) { m.Out = from.GetOut() m.Mentioned = from.GetMentioned() @@ -645,6 +653,10 @@ func (m *Message) FillFrom(from interface { m.TTLPeriod = val } + if val, ok := from.GetQuickReplyShortcutID(); ok { + m.QuickReplyShortcutID = val + } + } // TypeID returns type id in TL schema. @@ -831,6 +843,11 @@ func (m *Message) TypeInfo() tdp.Type { SchemaName: "ttl_period", Null: !m.Flags.Has(25), }, + { + Name: "QuickReplyShortcutID", + SchemaName: "quick_reply_shortcut_id", + Null: !m.Flags.Has(30), + }, } return typ } @@ -924,12 +941,15 @@ func (m *Message) SetFlags() { if !(m.TTLPeriod == 0) { m.Flags.Set(25) } + if !(m.QuickReplyShortcutID == 0) { + m.Flags.Set(30) + } } // Encode implements bin.Encoder. func (m *Message) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#1e4c8a69 as nil") + return fmt.Errorf("can't encode message#a66c7efc as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -938,41 +958,41 @@ func (m *Message) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *Message) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#1e4c8a69 as nil") + return fmt.Errorf("can't encode message#a66c7efc as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field flags: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field flags: %w", err) } b.PutInt(m.ID) if m.Flags.Has(8) { if m.FromID == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field from_id is nil") + return fmt.Errorf("unable to encode message#a66c7efc: field from_id is nil") } if err := m.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field from_id: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field from_id: %w", err) } } if m.Flags.Has(29) { b.PutInt(m.FromBoostsApplied) } if m.PeerID == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field peer_id is nil") + return fmt.Errorf("unable to encode message#a66c7efc: field peer_id is nil") } if err := m.PeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field peer_id: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field peer_id: %w", err) } if m.Flags.Has(28) { if m.SavedPeerID == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field saved_peer_id is nil") + return fmt.Errorf("unable to encode message#a66c7efc: field saved_peer_id is nil") } if err := m.SavedPeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field saved_peer_id: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field saved_peer_id: %w", err) } } if m.Flags.Has(2) { if err := m.FwdFrom.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field fwd_from: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field fwd_from: %w", err) } } if m.Flags.Has(11) { @@ -980,38 +1000,38 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(3) { if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field reply_to is nil") + return fmt.Errorf("unable to encode message#a66c7efc: field reply_to is nil") } if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field reply_to: %w", err) } } b.PutInt(m.Date) b.PutString(m.Message) if m.Flags.Has(9) { if m.Media == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field media is nil") + return fmt.Errorf("unable to encode message#a66c7efc: field media is nil") } if err := m.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field media: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field media: %w", err) } } if m.Flags.Has(6) { if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field reply_markup is nil") + return fmt.Errorf("unable to encode message#a66c7efc: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field reply_markup: %w", err) } } if m.Flags.Has(7) { b.PutVectorHeader(len(m.Entities)) for idx, v := range m.Entities { if v == nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode message#a66c7efc: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#a66c7efc: field entities element with index %d: %w", idx, err) } } } @@ -1023,7 +1043,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(23) { if err := m.Replies.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field replies: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field replies: %w", err) } } if m.Flags.Has(15) { @@ -1037,30 +1057,33 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(20) { if err := m.Reactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field reactions: %w", err) + return fmt.Errorf("unable to encode message#a66c7efc: field reactions: %w", err) } } if m.Flags.Has(22) { b.PutVectorHeader(len(m.RestrictionReason)) for idx, v := range m.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#1e4c8a69: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#a66c7efc: field restriction_reason element with index %d: %w", idx, err) } } } if m.Flags.Has(25) { b.PutInt(m.TTLPeriod) } + if m.Flags.Has(30) { + b.PutInt(m.QuickReplyShortcutID) + } return nil } // Decode implements bin.Decoder. func (m *Message) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#1e4c8a69 to nil") + return fmt.Errorf("can't decode message#a66c7efc to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: %w", err) } return m.DecodeBare(b) } @@ -1068,11 +1091,11 @@ func (m *Message) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *Message) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#1e4c8a69 to nil") + return fmt.Errorf("can't decode message#a66c7efc to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field flags: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field flags: %w", err) } } m.Out = m.Flags.Has(1) @@ -1089,89 +1112,89 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field id: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field id: %w", err) } m.ID = value } if m.Flags.Has(8) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field from_id: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field from_id: %w", err) } m.FromID = value } if m.Flags.Has(29) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field from_boosts_applied: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field from_boosts_applied: %w", err) } m.FromBoostsApplied = value } { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field peer_id: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field peer_id: %w", err) } m.PeerID = value } if m.Flags.Has(28) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field saved_peer_id: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field saved_peer_id: %w", err) } m.SavedPeerID = value } if m.Flags.Has(2) { if err := m.FwdFrom.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field fwd_from: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field fwd_from: %w", err) } } if m.Flags.Has(11) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field via_bot_id: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field via_bot_id: %w", err) } m.ViaBotID = value } if m.Flags.Has(3) { value, err := DecodeMessageReplyHeader(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field reply_to: %w", err) } m.ReplyTo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field date: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field date: %w", err) } m.Date = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field message: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field message: %w", err) } m.Message = value } if m.Flags.Has(9) { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field media: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field media: %w", err) } m.Media = value } if m.Flags.Has(6) { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field reply_markup: %w", err) } m.ReplyMarkup = value } if m.Flags.Has(7) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field entities: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field entities: %w", err) } if headerLen > 0 { @@ -1180,7 +1203,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field entities: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field entities: %w", err) } m.Entities = append(m.Entities, value) } @@ -1188,52 +1211,52 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field views: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field views: %w", err) } m.Views = value } if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field forwards: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field forwards: %w", err) } m.Forwards = value } if m.Flags.Has(23) { if err := m.Replies.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field replies: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field replies: %w", err) } } if m.Flags.Has(15) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field edit_date: %w", err) } m.EditDate = value } if m.Flags.Has(16) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field post_author: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field post_author: %w", err) } m.PostAuthor = value } if m.Flags.Has(17) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field grouped_id: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field grouped_id: %w", err) } m.GroupedID = value } if m.Flags.Has(20) { if err := m.Reactions.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field reactions: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field reactions: %w", err) } } if m.Flags.Has(22) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1242,7 +1265,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value RestrictionReason if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field restriction_reason: %w", err) } m.RestrictionReason = append(m.RestrictionReason, value) } @@ -1250,10 +1273,17 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(25) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#1e4c8a69: field ttl_period: %w", err) + return fmt.Errorf("unable to decode message#a66c7efc: field ttl_period: %w", err) } m.TTLPeriod = value } + if m.Flags.Has(30) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode message#a66c7efc: field quick_reply_shortcut_id: %w", err) + } + m.QuickReplyShortcutID = value + } return nil } @@ -1822,6 +1852,24 @@ func (m *Message) GetTTLPeriod() (value int, ok bool) { return m.TTLPeriod, true } +// SetQuickReplyShortcutID sets value of QuickReplyShortcutID conditional field. +func (m *Message) SetQuickReplyShortcutID(value int) { + m.Flags.Set(30) + m.QuickReplyShortcutID = value +} + +// GetQuickReplyShortcutID returns value of QuickReplyShortcutID conditional field and +// boolean which is true if field was set. +func (m *Message) GetQuickReplyShortcutID() (value int, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(30) { + return value, false + } + return m.QuickReplyShortcutID, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (m *Message) MapEntities() (value MessageEntityClassArray, ok bool) { if !m.Flags.Has(7) { @@ -2457,7 +2505,7 @@ const MessageClassName = "Message" // } // switch v := g.(type) { // case *tg.MessageEmpty: // messageEmpty#90a6ca84 -// case *tg.Message: // message#1e4c8a69 +// case *tg.Message: // message#a66c7efc // case *tg.MessageService: // messageService#2b085862 // default: panic(v) // } @@ -2595,7 +2643,7 @@ func DecodeMessage(buf *bin.Buffer) (MessageClass, error) { } return &v, nil case MessageTypeID: - // Decoding message#1e4c8a69. + // Decoding message#a66c7efc. v := Message{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageClass: %w", err) diff --git a/tg/tl_messages_check_quick_reply_shortcut_gen.go b/tg/tl_messages_check_quick_reply_shortcut_gen.go new file mode 100644 index 0000000000..418a87e200 --- /dev/null +++ b/tg/tl_messages_check_quick_reply_shortcut_gen.go @@ -0,0 +1,177 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesCheckQuickReplyShortcutRequest represents TL type `messages.checkQuickReplyShortcut#f1d0fbd3`. +// +// See https://core.telegram.org/method/messages.checkQuickReplyShortcut for reference. +type MessagesCheckQuickReplyShortcutRequest struct { + // Shortcut field of MessagesCheckQuickReplyShortcutRequest. + Shortcut string +} + +// MessagesCheckQuickReplyShortcutRequestTypeID is TL type id of MessagesCheckQuickReplyShortcutRequest. +const MessagesCheckQuickReplyShortcutRequestTypeID = 0xf1d0fbd3 + +// Ensuring interfaces in compile-time for MessagesCheckQuickReplyShortcutRequest. +var ( + _ bin.Encoder = &MessagesCheckQuickReplyShortcutRequest{} + _ bin.Decoder = &MessagesCheckQuickReplyShortcutRequest{} + _ bin.BareEncoder = &MessagesCheckQuickReplyShortcutRequest{} + _ bin.BareDecoder = &MessagesCheckQuickReplyShortcutRequest{} +) + +func (c *MessagesCheckQuickReplyShortcutRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Shortcut == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *MessagesCheckQuickReplyShortcutRequest) String() string { + if c == nil { + return "MessagesCheckQuickReplyShortcutRequest(nil)" + } + type Alias MessagesCheckQuickReplyShortcutRequest + return fmt.Sprintf("MessagesCheckQuickReplyShortcutRequest%+v", Alias(*c)) +} + +// FillFrom fills MessagesCheckQuickReplyShortcutRequest from given interface. +func (c *MessagesCheckQuickReplyShortcutRequest) FillFrom(from interface { + GetShortcut() (value string) +}) { + c.Shortcut = from.GetShortcut() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesCheckQuickReplyShortcutRequest) TypeID() uint32 { + return MessagesCheckQuickReplyShortcutRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesCheckQuickReplyShortcutRequest) TypeName() string { + return "messages.checkQuickReplyShortcut" +} + +// TypeInfo returns info about TL type. +func (c *MessagesCheckQuickReplyShortcutRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.checkQuickReplyShortcut", + ID: MessagesCheckQuickReplyShortcutRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Shortcut", + SchemaName: "shortcut", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *MessagesCheckQuickReplyShortcutRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.checkQuickReplyShortcut#f1d0fbd3 as nil") + } + b.PutID(MessagesCheckQuickReplyShortcutRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *MessagesCheckQuickReplyShortcutRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.checkQuickReplyShortcut#f1d0fbd3 as nil") + } + b.PutString(c.Shortcut) + return nil +} + +// Decode implements bin.Decoder. +func (c *MessagesCheckQuickReplyShortcutRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.checkQuickReplyShortcut#f1d0fbd3 to nil") + } + if err := b.ConsumeID(MessagesCheckQuickReplyShortcutRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.checkQuickReplyShortcut#f1d0fbd3: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *MessagesCheckQuickReplyShortcutRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.checkQuickReplyShortcut#f1d0fbd3 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.checkQuickReplyShortcut#f1d0fbd3: field shortcut: %w", err) + } + c.Shortcut = value + } + return nil +} + +// GetShortcut returns value of Shortcut field. +func (c *MessagesCheckQuickReplyShortcutRequest) GetShortcut() (value string) { + if c == nil { + return + } + return c.Shortcut +} + +// MessagesCheckQuickReplyShortcut invokes method messages.checkQuickReplyShortcut#f1d0fbd3 returning error if any. +// +// See https://core.telegram.org/method/messages.checkQuickReplyShortcut for reference. +func (c *Client) MessagesCheckQuickReplyShortcut(ctx context.Context, shortcut string) (bool, error) { + var result BoolBox + + request := &MessagesCheckQuickReplyShortcutRequest{ + Shortcut: shortcut, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_messages_check_quick_reply_shortcut_slices_gen.go b/tg/tl_messages_check_quick_reply_shortcut_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_check_quick_reply_shortcut_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_delete_quick_reply_messages_gen.go b/tg/tl_messages_delete_quick_reply_messages_gen.go new file mode 100644 index 0000000000..fac012ee12 --- /dev/null +++ b/tg/tl_messages_delete_quick_reply_messages_gen.go @@ -0,0 +1,213 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesDeleteQuickReplyMessagesRequest represents TL type `messages.deleteQuickReplyMessages#e105e910`. +// +// See https://core.telegram.org/method/messages.deleteQuickReplyMessages for reference. +type MessagesDeleteQuickReplyMessagesRequest struct { + // ShortcutID field of MessagesDeleteQuickReplyMessagesRequest. + ShortcutID int + // ID field of MessagesDeleteQuickReplyMessagesRequest. + ID []int +} + +// MessagesDeleteQuickReplyMessagesRequestTypeID is TL type id of MessagesDeleteQuickReplyMessagesRequest. +const MessagesDeleteQuickReplyMessagesRequestTypeID = 0xe105e910 + +// Ensuring interfaces in compile-time for MessagesDeleteQuickReplyMessagesRequest. +var ( + _ bin.Encoder = &MessagesDeleteQuickReplyMessagesRequest{} + _ bin.Decoder = &MessagesDeleteQuickReplyMessagesRequest{} + _ bin.BareEncoder = &MessagesDeleteQuickReplyMessagesRequest{} + _ bin.BareDecoder = &MessagesDeleteQuickReplyMessagesRequest{} +) + +func (d *MessagesDeleteQuickReplyMessagesRequest) Zero() bool { + if d == nil { + return true + } + if !(d.ShortcutID == 0) { + return false + } + if !(d.ID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *MessagesDeleteQuickReplyMessagesRequest) String() string { + if d == nil { + return "MessagesDeleteQuickReplyMessagesRequest(nil)" + } + type Alias MessagesDeleteQuickReplyMessagesRequest + return fmt.Sprintf("MessagesDeleteQuickReplyMessagesRequest%+v", Alias(*d)) +} + +// FillFrom fills MessagesDeleteQuickReplyMessagesRequest from given interface. +func (d *MessagesDeleteQuickReplyMessagesRequest) FillFrom(from interface { + GetShortcutID() (value int) + GetID() (value []int) +}) { + d.ShortcutID = from.GetShortcutID() + d.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesDeleteQuickReplyMessagesRequest) TypeID() uint32 { + return MessagesDeleteQuickReplyMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesDeleteQuickReplyMessagesRequest) TypeName() string { + return "messages.deleteQuickReplyMessages" +} + +// TypeInfo returns info about TL type. +func (d *MessagesDeleteQuickReplyMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.deleteQuickReplyMessages", + ID: MessagesDeleteQuickReplyMessagesRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *MessagesDeleteQuickReplyMessagesRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.deleteQuickReplyMessages#e105e910 as nil") + } + b.PutID(MessagesDeleteQuickReplyMessagesRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *MessagesDeleteQuickReplyMessagesRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.deleteQuickReplyMessages#e105e910 as nil") + } + b.PutInt(d.ShortcutID) + b.PutVectorHeader(len(d.ID)) + for _, v := range d.ID { + b.PutInt(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (d *MessagesDeleteQuickReplyMessagesRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.deleteQuickReplyMessages#e105e910 to nil") + } + if err := b.ConsumeID(MessagesDeleteQuickReplyMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.deleteQuickReplyMessages#e105e910: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *MessagesDeleteQuickReplyMessagesRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.deleteQuickReplyMessages#e105e910 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.deleteQuickReplyMessages#e105e910: field shortcut_id: %w", err) + } + d.ShortcutID = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.deleteQuickReplyMessages#e105e910: field id: %w", err) + } + + if headerLen > 0 { + d.ID = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.deleteQuickReplyMessages#e105e910: field id: %w", err) + } + d.ID = append(d.ID, value) + } + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (d *MessagesDeleteQuickReplyMessagesRequest) GetShortcutID() (value int) { + if d == nil { + return + } + return d.ShortcutID +} + +// GetID returns value of ID field. +func (d *MessagesDeleteQuickReplyMessagesRequest) GetID() (value []int) { + if d == nil { + return + } + return d.ID +} + +// MessagesDeleteQuickReplyMessages invokes method messages.deleteQuickReplyMessages#e105e910 returning error if any. +// +// See https://core.telegram.org/method/messages.deleteQuickReplyMessages for reference. +func (c *Client) MessagesDeleteQuickReplyMessages(ctx context.Context, request *MessagesDeleteQuickReplyMessagesRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_messages_delete_quick_reply_messages_slices_gen.go b/tg/tl_messages_delete_quick_reply_messages_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_delete_quick_reply_messages_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_delete_quick_reply_shortcut_gen.go b/tg/tl_messages_delete_quick_reply_shortcut_gen.go new file mode 100644 index 0000000000..e10f471a19 --- /dev/null +++ b/tg/tl_messages_delete_quick_reply_shortcut_gen.go @@ -0,0 +1,177 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesDeleteQuickReplyShortcutRequest represents TL type `messages.deleteQuickReplyShortcut#3cc04740`. +// +// See https://core.telegram.org/method/messages.deleteQuickReplyShortcut for reference. +type MessagesDeleteQuickReplyShortcutRequest struct { + // ShortcutID field of MessagesDeleteQuickReplyShortcutRequest. + ShortcutID int +} + +// MessagesDeleteQuickReplyShortcutRequestTypeID is TL type id of MessagesDeleteQuickReplyShortcutRequest. +const MessagesDeleteQuickReplyShortcutRequestTypeID = 0x3cc04740 + +// Ensuring interfaces in compile-time for MessagesDeleteQuickReplyShortcutRequest. +var ( + _ bin.Encoder = &MessagesDeleteQuickReplyShortcutRequest{} + _ bin.Decoder = &MessagesDeleteQuickReplyShortcutRequest{} + _ bin.BareEncoder = &MessagesDeleteQuickReplyShortcutRequest{} + _ bin.BareDecoder = &MessagesDeleteQuickReplyShortcutRequest{} +) + +func (d *MessagesDeleteQuickReplyShortcutRequest) Zero() bool { + if d == nil { + return true + } + if !(d.ShortcutID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *MessagesDeleteQuickReplyShortcutRequest) String() string { + if d == nil { + return "MessagesDeleteQuickReplyShortcutRequest(nil)" + } + type Alias MessagesDeleteQuickReplyShortcutRequest + return fmt.Sprintf("MessagesDeleteQuickReplyShortcutRequest%+v", Alias(*d)) +} + +// FillFrom fills MessagesDeleteQuickReplyShortcutRequest from given interface. +func (d *MessagesDeleteQuickReplyShortcutRequest) FillFrom(from interface { + GetShortcutID() (value int) +}) { + d.ShortcutID = from.GetShortcutID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesDeleteQuickReplyShortcutRequest) TypeID() uint32 { + return MessagesDeleteQuickReplyShortcutRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesDeleteQuickReplyShortcutRequest) TypeName() string { + return "messages.deleteQuickReplyShortcut" +} + +// TypeInfo returns info about TL type. +func (d *MessagesDeleteQuickReplyShortcutRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.deleteQuickReplyShortcut", + ID: MessagesDeleteQuickReplyShortcutRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *MessagesDeleteQuickReplyShortcutRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.deleteQuickReplyShortcut#3cc04740 as nil") + } + b.PutID(MessagesDeleteQuickReplyShortcutRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *MessagesDeleteQuickReplyShortcutRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.deleteQuickReplyShortcut#3cc04740 as nil") + } + b.PutInt(d.ShortcutID) + return nil +} + +// Decode implements bin.Decoder. +func (d *MessagesDeleteQuickReplyShortcutRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.deleteQuickReplyShortcut#3cc04740 to nil") + } + if err := b.ConsumeID(MessagesDeleteQuickReplyShortcutRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.deleteQuickReplyShortcut#3cc04740: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *MessagesDeleteQuickReplyShortcutRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.deleteQuickReplyShortcut#3cc04740 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.deleteQuickReplyShortcut#3cc04740: field shortcut_id: %w", err) + } + d.ShortcutID = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (d *MessagesDeleteQuickReplyShortcutRequest) GetShortcutID() (value int) { + if d == nil { + return + } + return d.ShortcutID +} + +// MessagesDeleteQuickReplyShortcut invokes method messages.deleteQuickReplyShortcut#3cc04740 returning error if any. +// +// See https://core.telegram.org/method/messages.deleteQuickReplyShortcut for reference. +func (c *Client) MessagesDeleteQuickReplyShortcut(ctx context.Context, shortcutid int) (bool, error) { + var result BoolBox + + request := &MessagesDeleteQuickReplyShortcutRequest{ + ShortcutID: shortcutid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_messages_delete_quick_reply_shortcut_slices_gen.go b/tg/tl_messages_delete_quick_reply_shortcut_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_delete_quick_reply_shortcut_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_dialog_filters_gen.go b/tg/tl_messages_dialog_filters_gen.go new file mode 100644 index 0000000000..18a445e06c --- /dev/null +++ b/tg/tl_messages_dialog_filters_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesDialogFilters represents TL type `messages.dialogFilters#2ad93719`. +// +// See https://core.telegram.org/constructor/messages.dialogFilters for reference. +type MessagesDialogFilters struct { + // Flags field of MessagesDialogFilters. + Flags bin.Fields + // TagsEnabled field of MessagesDialogFilters. + TagsEnabled bool + // Filters field of MessagesDialogFilters. + Filters []DialogFilterClass +} + +// MessagesDialogFiltersTypeID is TL type id of MessagesDialogFilters. +const MessagesDialogFiltersTypeID = 0x2ad93719 + +// Ensuring interfaces in compile-time for MessagesDialogFilters. +var ( + _ bin.Encoder = &MessagesDialogFilters{} + _ bin.Decoder = &MessagesDialogFilters{} + _ bin.BareEncoder = &MessagesDialogFilters{} + _ bin.BareDecoder = &MessagesDialogFilters{} +) + +func (d *MessagesDialogFilters) Zero() bool { + if d == nil { + return true + } + if !(d.Flags.Zero()) { + return false + } + if !(d.TagsEnabled == false) { + return false + } + if !(d.Filters == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *MessagesDialogFilters) String() string { + if d == nil { + return "MessagesDialogFilters(nil)" + } + type Alias MessagesDialogFilters + return fmt.Sprintf("MessagesDialogFilters%+v", Alias(*d)) +} + +// FillFrom fills MessagesDialogFilters from given interface. +func (d *MessagesDialogFilters) FillFrom(from interface { + GetTagsEnabled() (value bool) + GetFilters() (value []DialogFilterClass) +}) { + d.TagsEnabled = from.GetTagsEnabled() + d.Filters = from.GetFilters() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesDialogFilters) TypeID() uint32 { + return MessagesDialogFiltersTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesDialogFilters) TypeName() string { + return "messages.dialogFilters" +} + +// TypeInfo returns info about TL type. +func (d *MessagesDialogFilters) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.dialogFilters", + ID: MessagesDialogFiltersTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TagsEnabled", + SchemaName: "tags_enabled", + Null: !d.Flags.Has(0), + }, + { + Name: "Filters", + SchemaName: "filters", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (d *MessagesDialogFilters) SetFlags() { + if !(d.TagsEnabled == false) { + d.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (d *MessagesDialogFilters) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.dialogFilters#2ad93719 as nil") + } + b.PutID(MessagesDialogFiltersTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *MessagesDialogFilters) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.dialogFilters#2ad93719 as nil") + } + d.SetFlags() + if err := d.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.dialogFilters#2ad93719: field flags: %w", err) + } + b.PutVectorHeader(len(d.Filters)) + for idx, v := range d.Filters { + if v == nil { + return fmt.Errorf("unable to encode messages.dialogFilters#2ad93719: field filters element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.dialogFilters#2ad93719: field filters element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (d *MessagesDialogFilters) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.dialogFilters#2ad93719 to nil") + } + if err := b.ConsumeID(MessagesDialogFiltersTypeID); err != nil { + return fmt.Errorf("unable to decode messages.dialogFilters#2ad93719: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *MessagesDialogFilters) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.dialogFilters#2ad93719 to nil") + } + { + if err := d.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.dialogFilters#2ad93719: field flags: %w", err) + } + } + d.TagsEnabled = d.Flags.Has(0) + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.dialogFilters#2ad93719: field filters: %w", err) + } + + if headerLen > 0 { + d.Filters = make([]DialogFilterClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeDialogFilter(b) + if err != nil { + return fmt.Errorf("unable to decode messages.dialogFilters#2ad93719: field filters: %w", err) + } + d.Filters = append(d.Filters, value) + } + } + return nil +} + +// SetTagsEnabled sets value of TagsEnabled conditional field. +func (d *MessagesDialogFilters) SetTagsEnabled(value bool) { + if value { + d.Flags.Set(0) + d.TagsEnabled = true + } else { + d.Flags.Unset(0) + d.TagsEnabled = false + } +} + +// GetTagsEnabled returns value of TagsEnabled conditional field. +func (d *MessagesDialogFilters) GetTagsEnabled() (value bool) { + if d == nil { + return + } + return d.Flags.Has(0) +} + +// GetFilters returns value of Filters field. +func (d *MessagesDialogFilters) GetFilters() (value []DialogFilterClass) { + if d == nil { + return + } + return d.Filters +} + +// MapFilters returns field Filters wrapped in DialogFilterClassArray helper. +func (d *MessagesDialogFilters) MapFilters() (value DialogFilterClassArray) { + return DialogFilterClassArray(d.Filters) +} diff --git a/tg/tl_messages_dialog_filters_slices_gen.go b/tg/tl_messages_dialog_filters_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_dialog_filters_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_edit_message_gen.go b/tg/tl_messages_edit_message_gen.go index ab64f2d9cf..c5eb494030 100644 --- a/tg/tl_messages_edit_message_gen.go +++ b/tg/tl_messages_edit_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesEditMessageRequest represents TL type `messages.editMessage#48f71778`. +// MessagesEditMessageRequest represents TL type `messages.editMessage#dfd14005`. // Edit message // // See https://core.telegram.org/method/messages.editMessage for reference. @@ -76,10 +76,14 @@ type MessagesEditMessageRequest struct { // // Use SetScheduleDate and GetScheduleDate helpers. ScheduleDate int + // QuickReplyShortcutID field of MessagesEditMessageRequest. + // + // Use SetQuickReplyShortcutID and GetQuickReplyShortcutID helpers. + QuickReplyShortcutID int } // MessagesEditMessageRequestTypeID is TL type id of MessagesEditMessageRequest. -const MessagesEditMessageRequestTypeID = 0x48f71778 +const MessagesEditMessageRequestTypeID = 0xdfd14005 // Ensuring interfaces in compile-time for MessagesEditMessageRequest. var ( @@ -123,6 +127,9 @@ func (e *MessagesEditMessageRequest) Zero() bool { if !(e.ScheduleDate == 0) { return false } + if !(e.QuickReplyShortcutID == 0) { + return false + } return true } @@ -147,6 +154,7 @@ func (e *MessagesEditMessageRequest) FillFrom(from interface { GetReplyMarkup() (value ReplyMarkupClass, ok bool) GetEntities() (value []MessageEntityClass, ok bool) GetScheduleDate() (value int, ok bool) + GetQuickReplyShortcutID() (value int, ok bool) }) { e.NoWebpage = from.GetNoWebpage() e.InvertMedia = from.GetInvertMedia() @@ -172,6 +180,10 @@ func (e *MessagesEditMessageRequest) FillFrom(from interface { e.ScheduleDate = val } + if val, ok := from.GetQuickReplyShortcutID(); ok { + e.QuickReplyShortcutID = val + } + } // TypeID returns type id in TL schema. @@ -240,6 +252,11 @@ func (e *MessagesEditMessageRequest) TypeInfo() tdp.Type { SchemaName: "schedule_date", Null: !e.Flags.Has(15), }, + { + Name: "QuickReplyShortcutID", + SchemaName: "quick_reply_shortcut_id", + Null: !e.Flags.Has(17), + }, } return typ } @@ -267,12 +284,15 @@ func (e *MessagesEditMessageRequest) SetFlags() { if !(e.ScheduleDate == 0) { e.Flags.Set(15) } + if !(e.QuickReplyShortcutID == 0) { + e.Flags.Set(17) + } } // Encode implements bin.Encoder. func (e *MessagesEditMessageRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode messages.editMessage#48f71778 as nil") + return fmt.Errorf("can't encode messages.editMessage#dfd14005 as nil") } b.PutID(MessagesEditMessageRequestTypeID) return e.EncodeBare(b) @@ -281,17 +301,17 @@ func (e *MessagesEditMessageRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *MessagesEditMessageRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode messages.editMessage#48f71778 as nil") + return fmt.Errorf("can't encode messages.editMessage#dfd14005 as nil") } e.SetFlags() if err := e.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field flags: %w", err) + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field flags: %w", err) } if e.Peer == nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field peer is nil") + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field peer is nil") } if err := e.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field peer: %w", err) + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field peer: %w", err) } b.PutInt(e.ID) if e.Flags.Has(11) { @@ -299,44 +319,47 @@ func (e *MessagesEditMessageRequest) EncodeBare(b *bin.Buffer) error { } if e.Flags.Has(14) { if e.Media == nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field media is nil") + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field media is nil") } if err := e.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field media: %w", err) + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field media: %w", err) } } if e.Flags.Has(2) { if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field reply_markup is nil") + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field reply_markup is nil") } if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field reply_markup: %w", err) + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field reply_markup: %w", err) } } if e.Flags.Has(3) { b.PutVectorHeader(len(e.Entities)) for idx, v := range e.Entities { if v == nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.editMessage#48f71778: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messages.editMessage#dfd14005: field entities element with index %d: %w", idx, err) } } } if e.Flags.Has(15) { b.PutInt(e.ScheduleDate) } + if e.Flags.Has(17) { + b.PutInt(e.QuickReplyShortcutID) + } return nil } // Decode implements bin.Decoder. func (e *MessagesEditMessageRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode messages.editMessage#48f71778 to nil") + return fmt.Errorf("can't decode messages.editMessage#dfd14005 to nil") } if err := b.ConsumeID(MessagesEditMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: %w", err) } return e.DecodeBare(b) } @@ -344,11 +367,11 @@ func (e *MessagesEditMessageRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *MessagesEditMessageRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode messages.editMessage#48f71778 to nil") + return fmt.Errorf("can't decode messages.editMessage#dfd14005 to nil") } { if err := e.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field flags: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field flags: %w", err) } } e.NoWebpage = e.Flags.Has(1) @@ -356,42 +379,42 @@ func (e *MessagesEditMessageRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field peer: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field peer: %w", err) } e.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field id: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field id: %w", err) } e.ID = value } if e.Flags.Has(11) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field message: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field message: %w", err) } e.Message = value } if e.Flags.Has(14) { value, err := DecodeInputMedia(b) if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field media: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field media: %w", err) } e.Media = value } if e.Flags.Has(2) { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field reply_markup: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field reply_markup: %w", err) } e.ReplyMarkup = value } if e.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field entities: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field entities: %w", err) } if headerLen > 0 { @@ -400,7 +423,7 @@ func (e *MessagesEditMessageRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field entities: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field entities: %w", err) } e.Entities = append(e.Entities, value) } @@ -408,10 +431,17 @@ func (e *MessagesEditMessageRequest) DecodeBare(b *bin.Buffer) error { if e.Flags.Has(15) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.editMessage#48f71778: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field schedule_date: %w", err) } e.ScheduleDate = value } + if e.Flags.Has(17) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.editMessage#dfd14005: field quick_reply_shortcut_id: %w", err) + } + e.QuickReplyShortcutID = value + } return nil } @@ -559,6 +589,24 @@ func (e *MessagesEditMessageRequest) GetScheduleDate() (value int, ok bool) { return e.ScheduleDate, true } +// SetQuickReplyShortcutID sets value of QuickReplyShortcutID conditional field. +func (e *MessagesEditMessageRequest) SetQuickReplyShortcutID(value int) { + e.Flags.Set(17) + e.QuickReplyShortcutID = value +} + +// GetQuickReplyShortcutID returns value of QuickReplyShortcutID conditional field and +// boolean which is true if field was set. +func (e *MessagesEditMessageRequest) GetQuickReplyShortcutID() (value int, ok bool) { + if e == nil { + return + } + if !e.Flags.Has(17) { + return value, false + } + return e.QuickReplyShortcutID, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (e *MessagesEditMessageRequest) MapEntities() (value MessageEntityClassArray, ok bool) { if !e.Flags.Has(3) { @@ -567,7 +615,7 @@ func (e *MessagesEditMessageRequest) MapEntities() (value MessageEntityClassArra return MessageEntityClassArray(e.Entities), true } -// MessagesEditMessage invokes method messages.editMessage#48f71778 returning error if any. +// MessagesEditMessage invokes method messages.editMessage#dfd14005 returning error if any. // Edit message // // Possible errors: diff --git a/tg/tl_messages_edit_quick_reply_shortcut_gen.go b/tg/tl_messages_edit_quick_reply_shortcut_gen.go new file mode 100644 index 0000000000..686734eed4 --- /dev/null +++ b/tg/tl_messages_edit_quick_reply_shortcut_gen.go @@ -0,0 +1,201 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesEditQuickReplyShortcutRequest represents TL type `messages.editQuickReplyShortcut#5c003cef`. +// +// See https://core.telegram.org/method/messages.editQuickReplyShortcut for reference. +type MessagesEditQuickReplyShortcutRequest struct { + // ShortcutID field of MessagesEditQuickReplyShortcutRequest. + ShortcutID int + // Shortcut field of MessagesEditQuickReplyShortcutRequest. + Shortcut string +} + +// MessagesEditQuickReplyShortcutRequestTypeID is TL type id of MessagesEditQuickReplyShortcutRequest. +const MessagesEditQuickReplyShortcutRequestTypeID = 0x5c003cef + +// Ensuring interfaces in compile-time for MessagesEditQuickReplyShortcutRequest. +var ( + _ bin.Encoder = &MessagesEditQuickReplyShortcutRequest{} + _ bin.Decoder = &MessagesEditQuickReplyShortcutRequest{} + _ bin.BareEncoder = &MessagesEditQuickReplyShortcutRequest{} + _ bin.BareDecoder = &MessagesEditQuickReplyShortcutRequest{} +) + +func (e *MessagesEditQuickReplyShortcutRequest) Zero() bool { + if e == nil { + return true + } + if !(e.ShortcutID == 0) { + return false + } + if !(e.Shortcut == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *MessagesEditQuickReplyShortcutRequest) String() string { + if e == nil { + return "MessagesEditQuickReplyShortcutRequest(nil)" + } + type Alias MessagesEditQuickReplyShortcutRequest + return fmt.Sprintf("MessagesEditQuickReplyShortcutRequest%+v", Alias(*e)) +} + +// FillFrom fills MessagesEditQuickReplyShortcutRequest from given interface. +func (e *MessagesEditQuickReplyShortcutRequest) FillFrom(from interface { + GetShortcutID() (value int) + GetShortcut() (value string) +}) { + e.ShortcutID = from.GetShortcutID() + e.Shortcut = from.GetShortcut() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesEditQuickReplyShortcutRequest) TypeID() uint32 { + return MessagesEditQuickReplyShortcutRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesEditQuickReplyShortcutRequest) TypeName() string { + return "messages.editQuickReplyShortcut" +} + +// TypeInfo returns info about TL type. +func (e *MessagesEditQuickReplyShortcutRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.editQuickReplyShortcut", + ID: MessagesEditQuickReplyShortcutRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Shortcut", + SchemaName: "shortcut", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *MessagesEditQuickReplyShortcutRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.editQuickReplyShortcut#5c003cef as nil") + } + b.PutID(MessagesEditQuickReplyShortcutRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *MessagesEditQuickReplyShortcutRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.editQuickReplyShortcut#5c003cef as nil") + } + b.PutInt(e.ShortcutID) + b.PutString(e.Shortcut) + return nil +} + +// Decode implements bin.Decoder. +func (e *MessagesEditQuickReplyShortcutRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.editQuickReplyShortcut#5c003cef to nil") + } + if err := b.ConsumeID(MessagesEditQuickReplyShortcutRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.editQuickReplyShortcut#5c003cef: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *MessagesEditQuickReplyShortcutRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.editQuickReplyShortcut#5c003cef to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.editQuickReplyShortcut#5c003cef: field shortcut_id: %w", err) + } + e.ShortcutID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.editQuickReplyShortcut#5c003cef: field shortcut: %w", err) + } + e.Shortcut = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (e *MessagesEditQuickReplyShortcutRequest) GetShortcutID() (value int) { + if e == nil { + return + } + return e.ShortcutID +} + +// GetShortcut returns value of Shortcut field. +func (e *MessagesEditQuickReplyShortcutRequest) GetShortcut() (value string) { + if e == nil { + return + } + return e.Shortcut +} + +// MessagesEditQuickReplyShortcut invokes method messages.editQuickReplyShortcut#5c003cef returning error if any. +// +// See https://core.telegram.org/method/messages.editQuickReplyShortcut for reference. +func (c *Client) MessagesEditQuickReplyShortcut(ctx context.Context, request *MessagesEditQuickReplyShortcutRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_messages_edit_quick_reply_shortcut_slices_gen.go b/tg/tl_messages_edit_quick_reply_shortcut_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_edit_quick_reply_shortcut_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_forward_messages_gen.go b/tg/tl_messages_forward_messages_gen.go index 02ed47078a..0f2fbb7f3e 100644 --- a/tg/tl_messages_forward_messages_gen.go +++ b/tg/tl_messages_forward_messages_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#c661bbc4`. +// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#d5039208`. // Forwards messages by their IDs. // // See https://core.telegram.org/method/messages.forwardMessages for reference. @@ -81,10 +81,14 @@ type MessagesForwardMessagesRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass + // QuickReplyShortcut field of MessagesForwardMessagesRequest. + // + // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. + QuickReplyShortcut InputQuickReplyShortcutClass } // MessagesForwardMessagesRequestTypeID is TL type id of MessagesForwardMessagesRequest. -const MessagesForwardMessagesRequestTypeID = 0xc661bbc4 +const MessagesForwardMessagesRequestTypeID = 0xd5039208 // Ensuring interfaces in compile-time for MessagesForwardMessagesRequest. var ( @@ -140,6 +144,9 @@ func (f *MessagesForwardMessagesRequest) Zero() bool { if !(f.SendAs == nil) { return false } + if !(f.QuickReplyShortcut == nil) { + return false + } return true } @@ -168,6 +175,7 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface { GetTopMsgID() (value int, ok bool) GetScheduleDate() (value int, ok bool) GetSendAs() (value InputPeerClass, ok bool) + GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) }) { f.Silent = from.GetSilent() f.Background = from.GetBackground() @@ -191,6 +199,10 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface { f.SendAs = val } + if val, ok := from.GetQuickReplyShortcut(); ok { + f.QuickReplyShortcut = val + } + } // TypeID returns type id in TL schema. @@ -277,6 +289,11 @@ func (f *MessagesForwardMessagesRequest) TypeInfo() tdp.Type { SchemaName: "send_as", Null: !f.Flags.Has(13), }, + { + Name: "QuickReplyShortcut", + SchemaName: "quick_reply_shortcut", + Null: !f.Flags.Has(17), + }, } return typ } @@ -310,12 +327,15 @@ func (f *MessagesForwardMessagesRequest) SetFlags() { if !(f.SendAs == nil) { f.Flags.Set(13) } + if !(f.QuickReplyShortcut == nil) { + f.Flags.Set(17) + } } // Encode implements bin.Encoder. func (f *MessagesForwardMessagesRequest) Encode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode messages.forwardMessages#c661bbc4 as nil") + return fmt.Errorf("can't encode messages.forwardMessages#d5039208 as nil") } b.PutID(MessagesForwardMessagesRequestTypeID) return f.EncodeBare(b) @@ -324,17 +344,17 @@ func (f *MessagesForwardMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode messages.forwardMessages#c661bbc4 as nil") + return fmt.Errorf("can't encode messages.forwardMessages#d5039208 as nil") } f.SetFlags() if err := f.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field flags: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field flags: %w", err) } if f.FromPeer == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field from_peer is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field from_peer is nil") } if err := f.FromPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field from_peer: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field from_peer: %w", err) } b.PutVectorHeader(len(f.ID)) for _, v := range f.ID { @@ -345,10 +365,10 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { b.PutLong(v) } if f.ToPeer == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field to_peer is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field to_peer is nil") } if err := f.ToPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field to_peer: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field to_peer: %w", err) } if f.Flags.Has(9) { b.PutInt(f.TopMsgID) @@ -358,10 +378,18 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { } if f.Flags.Has(13) { if f.SendAs == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field send_as is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field send_as is nil") } if err := f.SendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#c661bbc4: field send_as: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field send_as: %w", err) + } + } + if f.Flags.Has(17) { + if f.QuickReplyShortcut == nil { + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field quick_reply_shortcut is nil") + } + if err := f.QuickReplyShortcut.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.forwardMessages#d5039208: field quick_reply_shortcut: %w", err) } } return nil @@ -370,10 +398,10 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (f *MessagesForwardMessagesRequest) Decode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode messages.forwardMessages#c661bbc4 to nil") + return fmt.Errorf("can't decode messages.forwardMessages#d5039208 to nil") } if err := b.ConsumeID(MessagesForwardMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: %w", err) } return f.DecodeBare(b) } @@ -381,11 +409,11 @@ func (f *MessagesForwardMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode messages.forwardMessages#c661bbc4 to nil") + return fmt.Errorf("can't decode messages.forwardMessages#d5039208 to nil") } { if err := f.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field flags: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field flags: %w", err) } } f.Silent = f.Flags.Has(5) @@ -397,14 +425,14 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field from_peer: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field from_peer: %w", err) } f.FromPeer = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field id: %w", err) } if headerLen > 0 { @@ -413,7 +441,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field id: %w", err) } f.ID = append(f.ID, value) } @@ -421,7 +449,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field random_id: %w", err) } if headerLen > 0 { @@ -430,7 +458,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field random_id: %w", err) } f.RandomID = append(f.RandomID, value) } @@ -438,31 +466,38 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field to_peer: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field to_peer: %w", err) } f.ToPeer = value } if f.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field top_msg_id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field top_msg_id: %w", err) } f.TopMsgID = value } if f.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field schedule_date: %w", err) } f.ScheduleDate = value } if f.Flags.Has(13) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#c661bbc4: field send_as: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field send_as: %w", err) } f.SendAs = value } + if f.Flags.Has(17) { + value, err := DecodeInputQuickReplyShortcut(b) + if err != nil { + return fmt.Errorf("unable to decode messages.forwardMessages#d5039208: field quick_reply_shortcut: %w", err) + } + f.QuickReplyShortcut = value + } return nil } @@ -666,7 +701,25 @@ func (f *MessagesForwardMessagesRequest) GetSendAs() (value InputPeerClass, ok b return f.SendAs, true } -// MessagesForwardMessages invokes method messages.forwardMessages#c661bbc4 returning error if any. +// SetQuickReplyShortcut sets value of QuickReplyShortcut conditional field. +func (f *MessagesForwardMessagesRequest) SetQuickReplyShortcut(value InputQuickReplyShortcutClass) { + f.Flags.Set(17) + f.QuickReplyShortcut = value +} + +// GetQuickReplyShortcut returns value of QuickReplyShortcut conditional field and +// boolean which is true if field was set. +func (f *MessagesForwardMessagesRequest) GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) { + if f == nil { + return + } + if !f.Flags.Has(17) { + return value, false + } + return f.QuickReplyShortcut, true +} + +// MessagesForwardMessages invokes method messages.forwardMessages#d5039208 returning error if any. // Forwards messages by their IDs. // // Possible errors: diff --git a/tg/tl_messages_get_dialog_filters_gen.go b/tg/tl_messages_get_dialog_filters_gen.go index bfbb058b91..5c53f7ccce 100644 --- a/tg/tl_messages_get_dialog_filters_gen.go +++ b/tg/tl_messages_get_dialog_filters_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesGetDialogFiltersRequest represents TL type `messages.getDialogFilters#f19ed96d`. +// MessagesGetDialogFiltersRequest represents TL type `messages.getDialogFilters#efd48c89`. // Get folders¹ // // Links: @@ -42,7 +42,7 @@ type MessagesGetDialogFiltersRequest struct { } // MessagesGetDialogFiltersRequestTypeID is TL type id of MessagesGetDialogFiltersRequest. -const MessagesGetDialogFiltersRequestTypeID = 0xf19ed96d +const MessagesGetDialogFiltersRequestTypeID = 0xefd48c89 // Ensuring interfaces in compile-time for MessagesGetDialogFiltersRequest. var ( @@ -98,7 +98,7 @@ func (g *MessagesGetDialogFiltersRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *MessagesGetDialogFiltersRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode messages.getDialogFilters#f19ed96d as nil") + return fmt.Errorf("can't encode messages.getDialogFilters#efd48c89 as nil") } b.PutID(MessagesGetDialogFiltersRequestTypeID) return g.EncodeBare(b) @@ -107,7 +107,7 @@ func (g *MessagesGetDialogFiltersRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *MessagesGetDialogFiltersRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode messages.getDialogFilters#f19ed96d as nil") + return fmt.Errorf("can't encode messages.getDialogFilters#efd48c89 as nil") } return nil } @@ -115,10 +115,10 @@ func (g *MessagesGetDialogFiltersRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *MessagesGetDialogFiltersRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode messages.getDialogFilters#f19ed96d to nil") + return fmt.Errorf("can't decode messages.getDialogFilters#efd48c89 to nil") } if err := b.ConsumeID(MessagesGetDialogFiltersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.getDialogFilters#f19ed96d: %w", err) + return fmt.Errorf("unable to decode messages.getDialogFilters#efd48c89: %w", err) } return g.DecodeBare(b) } @@ -126,24 +126,24 @@ func (g *MessagesGetDialogFiltersRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *MessagesGetDialogFiltersRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode messages.getDialogFilters#f19ed96d to nil") + return fmt.Errorf("can't decode messages.getDialogFilters#efd48c89 to nil") } return nil } -// MessagesGetDialogFilters invokes method messages.getDialogFilters#f19ed96d returning error if any. +// MessagesGetDialogFilters invokes method messages.getDialogFilters#efd48c89 returning error if any. // Get folders¹ // // Links: // 1. https://core.telegram.org/api/folders // // See https://core.telegram.org/method/messages.getDialogFilters for reference. -func (c *Client) MessagesGetDialogFilters(ctx context.Context) ([]DialogFilterClass, error) { - var result DialogFilterClassVector +func (c *Client) MessagesGetDialogFilters(ctx context.Context) (*MessagesDialogFilters, error) { + var result MessagesDialogFilters request := &MessagesGetDialogFiltersRequest{} if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } - return []DialogFilterClass(result.Elems), nil + return &result, nil } diff --git a/tg/tl_messages_get_quick_replies_gen.go b/tg/tl_messages_get_quick_replies_gen.go new file mode 100644 index 0000000000..f130682c59 --- /dev/null +++ b/tg/tl_messages_get_quick_replies_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesGetQuickRepliesRequest represents TL type `messages.getQuickReplies#d483f2a8`. +// +// See https://core.telegram.org/method/messages.getQuickReplies for reference. +type MessagesGetQuickRepliesRequest struct { + // Hash field of MessagesGetQuickRepliesRequest. + Hash int64 +} + +// MessagesGetQuickRepliesRequestTypeID is TL type id of MessagesGetQuickRepliesRequest. +const MessagesGetQuickRepliesRequestTypeID = 0xd483f2a8 + +// Ensuring interfaces in compile-time for MessagesGetQuickRepliesRequest. +var ( + _ bin.Encoder = &MessagesGetQuickRepliesRequest{} + _ bin.Decoder = &MessagesGetQuickRepliesRequest{} + _ bin.BareEncoder = &MessagesGetQuickRepliesRequest{} + _ bin.BareDecoder = &MessagesGetQuickRepliesRequest{} +) + +func (g *MessagesGetQuickRepliesRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetQuickRepliesRequest) String() string { + if g == nil { + return "MessagesGetQuickRepliesRequest(nil)" + } + type Alias MessagesGetQuickRepliesRequest + return fmt.Sprintf("MessagesGetQuickRepliesRequest%+v", Alias(*g)) +} + +// FillFrom fills MessagesGetQuickRepliesRequest from given interface. +func (g *MessagesGetQuickRepliesRequest) FillFrom(from interface { + GetHash() (value int64) +}) { + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetQuickRepliesRequest) TypeID() uint32 { + return MessagesGetQuickRepliesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetQuickRepliesRequest) TypeName() string { + return "messages.getQuickReplies" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetQuickRepliesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getQuickReplies", + ID: MessagesGetQuickRepliesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetQuickRepliesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getQuickReplies#d483f2a8 as nil") + } + b.PutID(MessagesGetQuickRepliesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetQuickRepliesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getQuickReplies#d483f2a8 as nil") + } + b.PutLong(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetQuickRepliesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getQuickReplies#d483f2a8 to nil") + } + if err := b.ConsumeID(MessagesGetQuickRepliesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplies#d483f2a8: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetQuickRepliesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getQuickReplies#d483f2a8 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplies#d483f2a8: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (g *MessagesGetQuickRepliesRequest) GetHash() (value int64) { + if g == nil { + return + } + return g.Hash +} + +// MessagesGetQuickReplies invokes method messages.getQuickReplies#d483f2a8 returning error if any. +// +// See https://core.telegram.org/method/messages.getQuickReplies for reference. +func (c *Client) MessagesGetQuickReplies(ctx context.Context, hash int64) (MessagesQuickRepliesClass, error) { + var result MessagesQuickRepliesBox + + request := &MessagesGetQuickRepliesRequest{ + Hash: hash, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.QuickReplies, nil +} diff --git a/tg/tl_messages_get_quick_replies_slices_gen.go b/tg/tl_messages_get_quick_replies_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_get_quick_replies_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_get_quick_reply_messages_gen.go b/tg/tl_messages_get_quick_reply_messages_gen.go new file mode 100644 index 0000000000..bcd2fbba52 --- /dev/null +++ b/tg/tl_messages_get_quick_reply_messages_gen.go @@ -0,0 +1,279 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesGetQuickReplyMessagesRequest represents TL type `messages.getQuickReplyMessages#94a495c3`. +// +// See https://core.telegram.org/method/messages.getQuickReplyMessages for reference. +type MessagesGetQuickReplyMessagesRequest struct { + // Flags field of MessagesGetQuickReplyMessagesRequest. + Flags bin.Fields + // ShortcutID field of MessagesGetQuickReplyMessagesRequest. + ShortcutID int + // ID field of MessagesGetQuickReplyMessagesRequest. + // + // Use SetID and GetID helpers. + ID []int + // Hash field of MessagesGetQuickReplyMessagesRequest. + Hash int64 +} + +// MessagesGetQuickReplyMessagesRequestTypeID is TL type id of MessagesGetQuickReplyMessagesRequest. +const MessagesGetQuickReplyMessagesRequestTypeID = 0x94a495c3 + +// Ensuring interfaces in compile-time for MessagesGetQuickReplyMessagesRequest. +var ( + _ bin.Encoder = &MessagesGetQuickReplyMessagesRequest{} + _ bin.Decoder = &MessagesGetQuickReplyMessagesRequest{} + _ bin.BareEncoder = &MessagesGetQuickReplyMessagesRequest{} + _ bin.BareDecoder = &MessagesGetQuickReplyMessagesRequest{} +) + +func (g *MessagesGetQuickReplyMessagesRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.ShortcutID == 0) { + return false + } + if !(g.ID == nil) { + return false + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetQuickReplyMessagesRequest) String() string { + if g == nil { + return "MessagesGetQuickReplyMessagesRequest(nil)" + } + type Alias MessagesGetQuickReplyMessagesRequest + return fmt.Sprintf("MessagesGetQuickReplyMessagesRequest%+v", Alias(*g)) +} + +// FillFrom fills MessagesGetQuickReplyMessagesRequest from given interface. +func (g *MessagesGetQuickReplyMessagesRequest) FillFrom(from interface { + GetShortcutID() (value int) + GetID() (value []int, ok bool) + GetHash() (value int64) +}) { + g.ShortcutID = from.GetShortcutID() + if val, ok := from.GetID(); ok { + g.ID = val + } + + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetQuickReplyMessagesRequest) TypeID() uint32 { + return MessagesGetQuickReplyMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetQuickReplyMessagesRequest) TypeName() string { + return "messages.getQuickReplyMessages" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetQuickReplyMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getQuickReplyMessages", + ID: MessagesGetQuickReplyMessagesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "ID", + SchemaName: "id", + Null: !g.Flags.Has(0), + }, + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *MessagesGetQuickReplyMessagesRequest) SetFlags() { + if !(g.ID == nil) { + g.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (g *MessagesGetQuickReplyMessagesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getQuickReplyMessages#94a495c3 as nil") + } + b.PutID(MessagesGetQuickReplyMessagesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetQuickReplyMessagesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getQuickReplyMessages#94a495c3 as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.getQuickReplyMessages#94a495c3: field flags: %w", err) + } + b.PutInt(g.ShortcutID) + if g.Flags.Has(0) { + b.PutVectorHeader(len(g.ID)) + for _, v := range g.ID { + b.PutInt(v) + } + } + b.PutLong(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetQuickReplyMessagesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getQuickReplyMessages#94a495c3 to nil") + } + if err := b.ConsumeID(MessagesGetQuickReplyMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplyMessages#94a495c3: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetQuickReplyMessagesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getQuickReplyMessages#94a495c3 to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplyMessages#94a495c3: field flags: %w", err) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplyMessages#94a495c3: field shortcut_id: %w", err) + } + g.ShortcutID = value + } + if g.Flags.Has(0) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplyMessages#94a495c3: field id: %w", err) + } + + if headerLen > 0 { + g.ID = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplyMessages#94a495c3: field id: %w", err) + } + g.ID = append(g.ID, value) + } + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.getQuickReplyMessages#94a495c3: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (g *MessagesGetQuickReplyMessagesRequest) GetShortcutID() (value int) { + if g == nil { + return + } + return g.ShortcutID +} + +// SetID sets value of ID conditional field. +func (g *MessagesGetQuickReplyMessagesRequest) SetID(value []int) { + g.Flags.Set(0) + g.ID = value +} + +// GetID returns value of ID conditional field and +// boolean which is true if field was set. +func (g *MessagesGetQuickReplyMessagesRequest) GetID() (value []int, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(0) { + return value, false + } + return g.ID, true +} + +// GetHash returns value of Hash field. +func (g *MessagesGetQuickReplyMessagesRequest) GetHash() (value int64) { + if g == nil { + return + } + return g.Hash +} + +// MessagesGetQuickReplyMessages invokes method messages.getQuickReplyMessages#94a495c3 returning error if any. +// +// See https://core.telegram.org/method/messages.getQuickReplyMessages for reference. +func (c *Client) MessagesGetQuickReplyMessages(ctx context.Context, request *MessagesGetQuickReplyMessagesRequest) (MessagesMessagesClass, error) { + var result MessagesMessagesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Messages, nil +} diff --git a/tg/tl_messages_get_quick_reply_messages_slices_gen.go b/tg/tl_messages_get_quick_reply_messages_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_get_quick_reply_messages_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_quick_replies_gen.go b/tg/tl_messages_quick_replies_gen.go new file mode 100644 index 0000000000..6557c1ac39 --- /dev/null +++ b/tg/tl_messages_quick_replies_gen.go @@ -0,0 +1,534 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesQuickReplies represents TL type `messages.quickReplies#c68d6695`. +// +// See https://core.telegram.org/constructor/messages.quickReplies for reference. +type MessagesQuickReplies struct { + // QuickReplies field of MessagesQuickReplies. + QuickReplies []QuickReply + // Messages field of MessagesQuickReplies. + Messages []MessageClass + // Chats field of MessagesQuickReplies. + Chats []ChatClass + // Users field of MessagesQuickReplies. + Users []UserClass +} + +// MessagesQuickRepliesTypeID is TL type id of MessagesQuickReplies. +const MessagesQuickRepliesTypeID = 0xc68d6695 + +// construct implements constructor of MessagesQuickRepliesClass. +func (q MessagesQuickReplies) construct() MessagesQuickRepliesClass { return &q } + +// Ensuring interfaces in compile-time for MessagesQuickReplies. +var ( + _ bin.Encoder = &MessagesQuickReplies{} + _ bin.Decoder = &MessagesQuickReplies{} + _ bin.BareEncoder = &MessagesQuickReplies{} + _ bin.BareDecoder = &MessagesQuickReplies{} + + _ MessagesQuickRepliesClass = &MessagesQuickReplies{} +) + +func (q *MessagesQuickReplies) Zero() bool { + if q == nil { + return true + } + if !(q.QuickReplies == nil) { + return false + } + if !(q.Messages == nil) { + return false + } + if !(q.Chats == nil) { + return false + } + if !(q.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (q *MessagesQuickReplies) String() string { + if q == nil { + return "MessagesQuickReplies(nil)" + } + type Alias MessagesQuickReplies + return fmt.Sprintf("MessagesQuickReplies%+v", Alias(*q)) +} + +// FillFrom fills MessagesQuickReplies from given interface. +func (q *MessagesQuickReplies) FillFrom(from interface { + GetQuickReplies() (value []QuickReply) + GetMessages() (value []MessageClass) + GetChats() (value []ChatClass) + GetUsers() (value []UserClass) +}) { + q.QuickReplies = from.GetQuickReplies() + q.Messages = from.GetMessages() + q.Chats = from.GetChats() + q.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesQuickReplies) TypeID() uint32 { + return MessagesQuickRepliesTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesQuickReplies) TypeName() string { + return "messages.quickReplies" +} + +// TypeInfo returns info about TL type. +func (q *MessagesQuickReplies) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.quickReplies", + ID: MessagesQuickRepliesTypeID, + } + if q == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "QuickReplies", + SchemaName: "quick_replies", + }, + { + Name: "Messages", + SchemaName: "messages", + }, + { + Name: "Chats", + SchemaName: "chats", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (q *MessagesQuickReplies) Encode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode messages.quickReplies#c68d6695 as nil") + } + b.PutID(MessagesQuickRepliesTypeID) + return q.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (q *MessagesQuickReplies) EncodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode messages.quickReplies#c68d6695 as nil") + } + b.PutVectorHeader(len(q.QuickReplies)) + for idx, v := range q.QuickReplies { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field quick_replies element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(q.Messages)) + for idx, v := range q.Messages { + if v == nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field messages element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field messages element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(q.Chats)) + for idx, v := range q.Chats { + if v == nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field chats element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(q.Users)) + for idx, v := range q.Users { + if v == nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.quickReplies#c68d6695: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (q *MessagesQuickReplies) Decode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode messages.quickReplies#c68d6695 to nil") + } + if err := b.ConsumeID(MessagesQuickRepliesTypeID); err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: %w", err) + } + return q.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (q *MessagesQuickReplies) DecodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode messages.quickReplies#c68d6695 to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field quick_replies: %w", err) + } + + if headerLen > 0 { + q.QuickReplies = make([]QuickReply, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value QuickReply + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field quick_replies: %w", err) + } + q.QuickReplies = append(q.QuickReplies, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field messages: %w", err) + } + + if headerLen > 0 { + q.Messages = make([]MessageClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field messages: %w", err) + } + q.Messages = append(q.Messages, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field chats: %w", err) + } + + if headerLen > 0 { + q.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field chats: %w", err) + } + q.Chats = append(q.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field users: %w", err) + } + + if headerLen > 0 { + q.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.quickReplies#c68d6695: field users: %w", err) + } + q.Users = append(q.Users, value) + } + } + return nil +} + +// GetQuickReplies returns value of QuickReplies field. +func (q *MessagesQuickReplies) GetQuickReplies() (value []QuickReply) { + if q == nil { + return + } + return q.QuickReplies +} + +// GetMessages returns value of Messages field. +func (q *MessagesQuickReplies) GetMessages() (value []MessageClass) { + if q == nil { + return + } + return q.Messages +} + +// GetChats returns value of Chats field. +func (q *MessagesQuickReplies) GetChats() (value []ChatClass) { + if q == nil { + return + } + return q.Chats +} + +// GetUsers returns value of Users field. +func (q *MessagesQuickReplies) GetUsers() (value []UserClass) { + if q == nil { + return + } + return q.Users +} + +// MapMessages returns field Messages wrapped in MessageClassArray helper. +func (q *MessagesQuickReplies) MapMessages() (value MessageClassArray) { + return MessageClassArray(q.Messages) +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (q *MessagesQuickReplies) MapChats() (value ChatClassArray) { + return ChatClassArray(q.Chats) +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (q *MessagesQuickReplies) MapUsers() (value UserClassArray) { + return UserClassArray(q.Users) +} + +// MessagesQuickRepliesNotModified represents TL type `messages.quickRepliesNotModified#5f91eb5b`. +// +// See https://core.telegram.org/constructor/messages.quickRepliesNotModified for reference. +type MessagesQuickRepliesNotModified struct { +} + +// MessagesQuickRepliesNotModifiedTypeID is TL type id of MessagesQuickRepliesNotModified. +const MessagesQuickRepliesNotModifiedTypeID = 0x5f91eb5b + +// construct implements constructor of MessagesQuickRepliesClass. +func (q MessagesQuickRepliesNotModified) construct() MessagesQuickRepliesClass { return &q } + +// Ensuring interfaces in compile-time for MessagesQuickRepliesNotModified. +var ( + _ bin.Encoder = &MessagesQuickRepliesNotModified{} + _ bin.Decoder = &MessagesQuickRepliesNotModified{} + _ bin.BareEncoder = &MessagesQuickRepliesNotModified{} + _ bin.BareDecoder = &MessagesQuickRepliesNotModified{} + + _ MessagesQuickRepliesClass = &MessagesQuickRepliesNotModified{} +) + +func (q *MessagesQuickRepliesNotModified) Zero() bool { + if q == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (q *MessagesQuickRepliesNotModified) String() string { + if q == nil { + return "MessagesQuickRepliesNotModified(nil)" + } + type Alias MessagesQuickRepliesNotModified + return fmt.Sprintf("MessagesQuickRepliesNotModified%+v", Alias(*q)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesQuickRepliesNotModified) TypeID() uint32 { + return MessagesQuickRepliesNotModifiedTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesQuickRepliesNotModified) TypeName() string { + return "messages.quickRepliesNotModified" +} + +// TypeInfo returns info about TL type. +func (q *MessagesQuickRepliesNotModified) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.quickRepliesNotModified", + ID: MessagesQuickRepliesNotModifiedTypeID, + } + if q == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (q *MessagesQuickRepliesNotModified) Encode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode messages.quickRepliesNotModified#5f91eb5b as nil") + } + b.PutID(MessagesQuickRepliesNotModifiedTypeID) + return q.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (q *MessagesQuickRepliesNotModified) EncodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode messages.quickRepliesNotModified#5f91eb5b as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (q *MessagesQuickRepliesNotModified) Decode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode messages.quickRepliesNotModified#5f91eb5b to nil") + } + if err := b.ConsumeID(MessagesQuickRepliesNotModifiedTypeID); err != nil { + return fmt.Errorf("unable to decode messages.quickRepliesNotModified#5f91eb5b: %w", err) + } + return q.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (q *MessagesQuickRepliesNotModified) DecodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode messages.quickRepliesNotModified#5f91eb5b to nil") + } + return nil +} + +// MessagesQuickRepliesClassName is schema name of MessagesQuickRepliesClass. +const MessagesQuickRepliesClassName = "messages.QuickReplies" + +// MessagesQuickRepliesClass represents messages.QuickReplies generic type. +// +// See https://core.telegram.org/type/messages.QuickReplies for reference. +// +// Example: +// +// g, err := tg.DecodeMessagesQuickReplies(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.MessagesQuickReplies: // messages.quickReplies#c68d6695 +// case *tg.MessagesQuickRepliesNotModified: // messages.quickRepliesNotModified#5f91eb5b +// default: panic(v) +// } +type MessagesQuickRepliesClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() MessagesQuickRepliesClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // AsModified tries to map MessagesQuickRepliesClass to MessagesQuickReplies. + AsModified() (*MessagesQuickReplies, bool) +} + +// AsModified tries to map MessagesQuickReplies to MessagesQuickReplies. +func (q *MessagesQuickReplies) AsModified() (*MessagesQuickReplies, bool) { + return q, true +} + +// AsModified tries to map MessagesQuickRepliesNotModified to MessagesQuickReplies. +func (q *MessagesQuickRepliesNotModified) AsModified() (*MessagesQuickReplies, bool) { + return nil, false +} + +// DecodeMessagesQuickReplies implements binary de-serialization for MessagesQuickRepliesClass. +func DecodeMessagesQuickReplies(buf *bin.Buffer) (MessagesQuickRepliesClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case MessagesQuickRepliesTypeID: + // Decoding messages.quickReplies#c68d6695. + v := MessagesQuickReplies{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessagesQuickRepliesClass: %w", err) + } + return &v, nil + case MessagesQuickRepliesNotModifiedTypeID: + // Decoding messages.quickRepliesNotModified#5f91eb5b. + v := MessagesQuickRepliesNotModified{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessagesQuickRepliesClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode MessagesQuickRepliesClass: %w", bin.NewUnexpectedID(id)) + } +} + +// MessagesQuickReplies boxes the MessagesQuickRepliesClass providing a helper. +type MessagesQuickRepliesBox struct { + QuickReplies MessagesQuickRepliesClass +} + +// Decode implements bin.Decoder for MessagesQuickRepliesBox. +func (b *MessagesQuickRepliesBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode MessagesQuickRepliesBox to nil") + } + v, err := DecodeMessagesQuickReplies(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.QuickReplies = v + return nil +} + +// Encode implements bin.Encode for MessagesQuickRepliesBox. +func (b *MessagesQuickRepliesBox) Encode(buf *bin.Buffer) error { + if b == nil || b.QuickReplies == nil { + return fmt.Errorf("unable to encode MessagesQuickRepliesClass as nil") + } + return b.QuickReplies.Encode(buf) +} diff --git a/tg/tl_messages_quick_replies_slices_gen.go b/tg/tl_messages_quick_replies_slices_gen.go new file mode 100644 index 0000000000..ab031ea040 --- /dev/null +++ b/tg/tl_messages_quick_replies_slices_gen.go @@ -0,0 +1,267 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesQuickRepliesClassArray is adapter for slice of MessagesQuickRepliesClass. +type MessagesQuickRepliesClassArray []MessagesQuickRepliesClass + +// Sort sorts slice of MessagesQuickRepliesClass. +func (s MessagesQuickRepliesClassArray) Sort(less func(a, b MessagesQuickRepliesClass) bool) MessagesQuickRepliesClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessagesQuickRepliesClass. +func (s MessagesQuickRepliesClassArray) SortStable(less func(a, b MessagesQuickRepliesClass) bool) MessagesQuickRepliesClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessagesQuickRepliesClass. +func (s MessagesQuickRepliesClassArray) Retain(keep func(x MessagesQuickRepliesClass) bool) MessagesQuickRepliesClassArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessagesQuickRepliesClassArray) First() (v MessagesQuickRepliesClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessagesQuickRepliesClassArray) Last() (v MessagesQuickRepliesClass, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessagesQuickRepliesClassArray) PopFirst() (v MessagesQuickRepliesClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessagesQuickRepliesClass + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessagesQuickRepliesClassArray) Pop() (v MessagesQuickRepliesClass, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// AsMessagesQuickReplies returns copy with only MessagesQuickReplies constructors. +func (s MessagesQuickRepliesClassArray) AsMessagesQuickReplies() (to MessagesQuickRepliesArray) { + for _, elem := range s { + value, ok := elem.(*MessagesQuickReplies) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AppendOnlyModified appends only Modified constructors to +// given slice. +func (s MessagesQuickRepliesClassArray) AppendOnlyModified(to []*MessagesQuickReplies) []*MessagesQuickReplies { + for _, elem := range s { + value, ok := elem.AsModified() + if !ok { + continue + } + to = append(to, value) + } + + return to +} + +// AsModified returns copy with only Modified constructors. +func (s MessagesQuickRepliesClassArray) AsModified() (to []*MessagesQuickReplies) { + return s.AppendOnlyModified(to) +} + +// FirstAsModified returns first element of slice (if exists). +func (s MessagesQuickRepliesClassArray) FirstAsModified() (v *MessagesQuickReplies, ok bool) { + value, ok := s.First() + if !ok { + return + } + return value.AsModified() +} + +// LastAsModified returns last element of slice (if exists). +func (s MessagesQuickRepliesClassArray) LastAsModified() (v *MessagesQuickReplies, ok bool) { + value, ok := s.Last() + if !ok { + return + } + return value.AsModified() +} + +// PopFirstAsModified returns element of slice (if exists). +func (s *MessagesQuickRepliesClassArray) PopFirstAsModified() (v *MessagesQuickReplies, ok bool) { + value, ok := s.PopFirst() + if !ok { + return + } + return value.AsModified() +} + +// PopAsModified returns element of slice (if exists). +func (s *MessagesQuickRepliesClassArray) PopAsModified() (v *MessagesQuickReplies, ok bool) { + value, ok := s.Pop() + if !ok { + return + } + return value.AsModified() +} + +// MessagesQuickRepliesArray is adapter for slice of MessagesQuickReplies. +type MessagesQuickRepliesArray []MessagesQuickReplies + +// Sort sorts slice of MessagesQuickReplies. +func (s MessagesQuickRepliesArray) Sort(less func(a, b MessagesQuickReplies) bool) MessagesQuickRepliesArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessagesQuickReplies. +func (s MessagesQuickRepliesArray) SortStable(less func(a, b MessagesQuickReplies) bool) MessagesQuickRepliesArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessagesQuickReplies. +func (s MessagesQuickRepliesArray) Retain(keep func(x MessagesQuickReplies) bool) MessagesQuickRepliesArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessagesQuickRepliesArray) First() (v MessagesQuickReplies, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessagesQuickRepliesArray) Last() (v MessagesQuickReplies, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessagesQuickRepliesArray) PopFirst() (v MessagesQuickReplies, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessagesQuickReplies + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessagesQuickRepliesArray) Pop() (v MessagesQuickReplies, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_messages_reorder_quick_replies_gen.go b/tg/tl_messages_reorder_quick_replies_gen.go new file mode 100644 index 0000000000..e768743f1e --- /dev/null +++ b/tg/tl_messages_reorder_quick_replies_gen.go @@ -0,0 +1,190 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesReorderQuickRepliesRequest represents TL type `messages.reorderQuickReplies#60331907`. +// +// See https://core.telegram.org/method/messages.reorderQuickReplies for reference. +type MessagesReorderQuickRepliesRequest struct { + // Order field of MessagesReorderQuickRepliesRequest. + Order []int +} + +// MessagesReorderQuickRepliesRequestTypeID is TL type id of MessagesReorderQuickRepliesRequest. +const MessagesReorderQuickRepliesRequestTypeID = 0x60331907 + +// Ensuring interfaces in compile-time for MessagesReorderQuickRepliesRequest. +var ( + _ bin.Encoder = &MessagesReorderQuickRepliesRequest{} + _ bin.Decoder = &MessagesReorderQuickRepliesRequest{} + _ bin.BareEncoder = &MessagesReorderQuickRepliesRequest{} + _ bin.BareDecoder = &MessagesReorderQuickRepliesRequest{} +) + +func (r *MessagesReorderQuickRepliesRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Order == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *MessagesReorderQuickRepliesRequest) String() string { + if r == nil { + return "MessagesReorderQuickRepliesRequest(nil)" + } + type Alias MessagesReorderQuickRepliesRequest + return fmt.Sprintf("MessagesReorderQuickRepliesRequest%+v", Alias(*r)) +} + +// FillFrom fills MessagesReorderQuickRepliesRequest from given interface. +func (r *MessagesReorderQuickRepliesRequest) FillFrom(from interface { + GetOrder() (value []int) +}) { + r.Order = from.GetOrder() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesReorderQuickRepliesRequest) TypeID() uint32 { + return MessagesReorderQuickRepliesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesReorderQuickRepliesRequest) TypeName() string { + return "messages.reorderQuickReplies" +} + +// TypeInfo returns info about TL type. +func (r *MessagesReorderQuickRepliesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.reorderQuickReplies", + ID: MessagesReorderQuickRepliesRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Order", + SchemaName: "order", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *MessagesReorderQuickRepliesRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode messages.reorderQuickReplies#60331907 as nil") + } + b.PutID(MessagesReorderQuickRepliesRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *MessagesReorderQuickRepliesRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode messages.reorderQuickReplies#60331907 as nil") + } + b.PutVectorHeader(len(r.Order)) + for _, v := range r.Order { + b.PutInt(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (r *MessagesReorderQuickRepliesRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode messages.reorderQuickReplies#60331907 to nil") + } + if err := b.ConsumeID(MessagesReorderQuickRepliesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.reorderQuickReplies#60331907: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *MessagesReorderQuickRepliesRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode messages.reorderQuickReplies#60331907 to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.reorderQuickReplies#60331907: field order: %w", err) + } + + if headerLen > 0 { + r.Order = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.reorderQuickReplies#60331907: field order: %w", err) + } + r.Order = append(r.Order, value) + } + } + return nil +} + +// GetOrder returns value of Order field. +func (r *MessagesReorderQuickRepliesRequest) GetOrder() (value []int) { + if r == nil { + return + } + return r.Order +} + +// MessagesReorderQuickReplies invokes method messages.reorderQuickReplies#60331907 returning error if any. +// +// See https://core.telegram.org/method/messages.reorderQuickReplies for reference. +func (c *Client) MessagesReorderQuickReplies(ctx context.Context, order []int) (bool, error) { + var result BoolBox + + request := &MessagesReorderQuickRepliesRequest{ + Order: order, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_messages_reorder_quick_replies_slices_gen.go b/tg/tl_messages_reorder_quick_replies_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_reorder_quick_replies_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_send_inline_bot_result_gen.go b/tg/tl_messages_send_inline_bot_result_gen.go index a0cfd02e27..4e66c69447 100644 --- a/tg/tl_messages_send_inline_bot_result_gen.go +++ b/tg/tl_messages_send_inline_bot_result_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSendInlineBotResultRequest represents TL type `messages.sendInlineBotResult#f7bc68ba`. +// MessagesSendInlineBotResultRequest represents TL type `messages.sendInlineBotResult#3ebee86a`. // Send a result obtained using messages.getInlineBotResults¹. // // Links: @@ -87,10 +87,14 @@ type MessagesSendInlineBotResultRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass + // QuickReplyShortcut field of MessagesSendInlineBotResultRequest. + // + // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. + QuickReplyShortcut InputQuickReplyShortcutClass } // MessagesSendInlineBotResultRequestTypeID is TL type id of MessagesSendInlineBotResultRequest. -const MessagesSendInlineBotResultRequestTypeID = 0xf7bc68ba +const MessagesSendInlineBotResultRequestTypeID = 0x3ebee86a // Ensuring interfaces in compile-time for MessagesSendInlineBotResultRequest. var ( @@ -140,6 +144,9 @@ func (s *MessagesSendInlineBotResultRequest) Zero() bool { if !(s.SendAs == nil) { return false } + if !(s.QuickReplyShortcut == nil) { + return false + } return true } @@ -166,6 +173,7 @@ func (s *MessagesSendInlineBotResultRequest) FillFrom(from interface { GetID() (value string) GetScheduleDate() (value int, ok bool) GetSendAs() (value InputPeerClass, ok bool) + GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) }) { s.Silent = from.GetSilent() s.Background = from.GetBackground() @@ -187,6 +195,10 @@ func (s *MessagesSendInlineBotResultRequest) FillFrom(from interface { s.SendAs = val } + if val, ok := from.GetQuickReplyShortcut(); ok { + s.QuickReplyShortcut = val + } + } // TypeID returns type id in TL schema. @@ -263,6 +275,11 @@ func (s *MessagesSendInlineBotResultRequest) TypeInfo() tdp.Type { SchemaName: "send_as", Null: !s.Flags.Has(13), }, + { + Name: "QuickReplyShortcut", + SchemaName: "quick_reply_shortcut", + Null: !s.Flags.Has(17), + }, } return typ } @@ -290,12 +307,15 @@ func (s *MessagesSendInlineBotResultRequest) SetFlags() { if !(s.SendAs == nil) { s.Flags.Set(13) } + if !(s.QuickReplyShortcut == nil) { + s.Flags.Set(17) + } } // Encode implements bin.Encoder. func (s *MessagesSendInlineBotResultRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendInlineBotResult#f7bc68ba as nil") + return fmt.Errorf("can't encode messages.sendInlineBotResult#3ebee86a as nil") } b.PutID(MessagesSendInlineBotResultRequestTypeID) return s.EncodeBare(b) @@ -304,24 +324,24 @@ func (s *MessagesSendInlineBotResultRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSendInlineBotResultRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendInlineBotResult#f7bc68ba as nil") + return fmt.Errorf("can't encode messages.sendInlineBotResult#3ebee86a as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field flags: %w", err) + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field peer is nil") + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field peer: %w", err) + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field peer: %w", err) } if s.Flags.Has(0) { if s.ReplyTo == nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field reply_to is nil") + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field reply_to is nil") } if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field reply_to: %w", err) + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field reply_to: %w", err) } } b.PutLong(s.RandomID) @@ -332,10 +352,18 @@ func (s *MessagesSendInlineBotResultRequest) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(13) { if s.SendAs == nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field send_as is nil") + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field send_as is nil") } if err := s.SendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field send_as: %w", err) + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field send_as: %w", err) + } + } + if s.Flags.Has(17) { + if s.QuickReplyShortcut == nil { + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field quick_reply_shortcut is nil") + } + if err := s.QuickReplyShortcut.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendInlineBotResult#3ebee86a: field quick_reply_shortcut: %w", err) } } return nil @@ -344,10 +372,10 @@ func (s *MessagesSendInlineBotResultRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *MessagesSendInlineBotResultRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendInlineBotResult#f7bc68ba to nil") + return fmt.Errorf("can't decode messages.sendInlineBotResult#3ebee86a to nil") } if err := b.ConsumeID(MessagesSendInlineBotResultRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: %w", err) } return s.DecodeBare(b) } @@ -355,11 +383,11 @@ func (s *MessagesSendInlineBotResultRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSendInlineBotResultRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendInlineBotResult#f7bc68ba to nil") + return fmt.Errorf("can't decode messages.sendInlineBotResult#3ebee86a to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field flags: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field flags: %w", err) } } s.Silent = s.Flags.Has(5) @@ -369,52 +397,59 @@ func (s *MessagesSendInlineBotResultRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field peer: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field peer: %w", err) } s.Peer = value } if s.Flags.Has(0) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field reply_to: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field reply_to: %w", err) } s.ReplyTo = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field random_id: %w", err) } s.RandomID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field query_id: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field query_id: %w", err) } s.QueryID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field id: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field id: %w", err) } s.ID = value } if s.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field schedule_date: %w", err) } s.ScheduleDate = value } if s.Flags.Has(13) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field send_as: %w", err) + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field send_as: %w", err) } s.SendAs = value } + if s.Flags.Has(17) { + value, err := DecodeInputQuickReplyShortcut(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendInlineBotResult#3ebee86a: field quick_reply_shortcut: %w", err) + } + s.QuickReplyShortcut = value + } return nil } @@ -580,7 +615,25 @@ func (s *MessagesSendInlineBotResultRequest) GetSendAs() (value InputPeerClass, return s.SendAs, true } -// MessagesSendInlineBotResult invokes method messages.sendInlineBotResult#f7bc68ba returning error if any. +// SetQuickReplyShortcut sets value of QuickReplyShortcut conditional field. +func (s *MessagesSendInlineBotResultRequest) SetQuickReplyShortcut(value InputQuickReplyShortcutClass) { + s.Flags.Set(17) + s.QuickReplyShortcut = value +} + +// GetQuickReplyShortcut returns value of QuickReplyShortcut conditional field and +// boolean which is true if field was set. +func (s *MessagesSendInlineBotResultRequest) GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(17) { + return value, false + } + return s.QuickReplyShortcut, true +} + +// MessagesSendInlineBotResult invokes method messages.sendInlineBotResult#3ebee86a returning error if any. // Send a result obtained using messages.getInlineBotResults¹. // // Links: diff --git a/tg/tl_messages_send_media_gen.go b/tg/tl_messages_send_media_gen.go index 13abe0833d..022aac02a0 100644 --- a/tg/tl_messages_send_media_gen.go +++ b/tg/tl_messages_send_media_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSendMediaRequest represents TL type `messages.sendMedia#72ccc23d`. +// MessagesSendMediaRequest represents TL type `messages.sendMedia#7bd66041`. // Send a media // // See https://core.telegram.org/method/messages.sendMedia for reference. @@ -96,10 +96,14 @@ type MessagesSendMediaRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass + // QuickReplyShortcut field of MessagesSendMediaRequest. + // + // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. + QuickReplyShortcut InputQuickReplyShortcutClass } // MessagesSendMediaRequestTypeID is TL type id of MessagesSendMediaRequest. -const MessagesSendMediaRequestTypeID = 0x72ccc23d +const MessagesSendMediaRequestTypeID = 0x7bd66041 // Ensuring interfaces in compile-time for MessagesSendMediaRequest. var ( @@ -161,6 +165,9 @@ func (s *MessagesSendMediaRequest) Zero() bool { if !(s.SendAs == nil) { return false } + if !(s.QuickReplyShortcut == nil) { + return false + } return true } @@ -191,6 +198,7 @@ func (s *MessagesSendMediaRequest) FillFrom(from interface { GetEntities() (value []MessageEntityClass, ok bool) GetScheduleDate() (value int, ok bool) GetSendAs() (value InputPeerClass, ok bool) + GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) }) { s.Silent = from.GetSilent() s.Background = from.GetBackground() @@ -222,6 +230,10 @@ func (s *MessagesSendMediaRequest) FillFrom(from interface { s.SendAs = val } + if val, ok := from.GetQuickReplyShortcut(); ok { + s.QuickReplyShortcut = val + } + } // TypeID returns type id in TL schema. @@ -318,6 +330,11 @@ func (s *MessagesSendMediaRequest) TypeInfo() tdp.Type { SchemaName: "send_as", Null: !s.Flags.Has(13), }, + { + Name: "QuickReplyShortcut", + SchemaName: "quick_reply_shortcut", + Null: !s.Flags.Has(17), + }, } return typ } @@ -357,12 +374,15 @@ func (s *MessagesSendMediaRequest) SetFlags() { if !(s.SendAs == nil) { s.Flags.Set(13) } + if !(s.QuickReplyShortcut == nil) { + s.Flags.Set(17) + } } // Encode implements bin.Encoder. func (s *MessagesSendMediaRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendMedia#72ccc23d as nil") + return fmt.Errorf("can't encode messages.sendMedia#7bd66041 as nil") } b.PutID(MessagesSendMediaRequestTypeID) return s.EncodeBare(b) @@ -371,50 +391,50 @@ func (s *MessagesSendMediaRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSendMediaRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendMedia#72ccc23d as nil") + return fmt.Errorf("can't encode messages.sendMedia#7bd66041 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field flags: %w", err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field peer is nil") + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field peer: %w", err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field peer: %w", err) } if s.Flags.Has(0) { if s.ReplyTo == nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field reply_to is nil") + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field reply_to is nil") } if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field reply_to: %w", err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field reply_to: %w", err) } } if s.Media == nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field media is nil") + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field media is nil") } if err := s.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field media: %w", err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field media: %w", err) } b.PutString(s.Message) b.PutLong(s.RandomID) if s.Flags.Has(2) { if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field reply_markup is nil") + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field reply_markup is nil") } if err := s.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field reply_markup: %w", err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field reply_markup: %w", err) } } if s.Flags.Has(3) { b.PutVectorHeader(len(s.Entities)) for idx, v := range s.Entities { if v == nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field entities element with index %d: %w", idx, err) } } } @@ -423,10 +443,18 @@ func (s *MessagesSendMediaRequest) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(13) { if s.SendAs == nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field send_as is nil") + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field send_as is nil") } if err := s.SendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMedia#72ccc23d: field send_as: %w", err) + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field send_as: %w", err) + } + } + if s.Flags.Has(17) { + if s.QuickReplyShortcut == nil { + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field quick_reply_shortcut is nil") + } + if err := s.QuickReplyShortcut.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendMedia#7bd66041: field quick_reply_shortcut: %w", err) } } return nil @@ -435,10 +463,10 @@ func (s *MessagesSendMediaRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *MessagesSendMediaRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendMedia#72ccc23d to nil") + return fmt.Errorf("can't decode messages.sendMedia#7bd66041 to nil") } if err := b.ConsumeID(MessagesSendMediaRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: %w", err) } return s.DecodeBare(b) } @@ -446,11 +474,11 @@ func (s *MessagesSendMediaRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSendMediaRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendMedia#72ccc23d to nil") + return fmt.Errorf("can't decode messages.sendMedia#7bd66041 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field flags: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field flags: %w", err) } } s.Silent = s.Flags.Has(5) @@ -462,49 +490,49 @@ func (s *MessagesSendMediaRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field peer: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field peer: %w", err) } s.Peer = value } if s.Flags.Has(0) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field reply_to: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field reply_to: %w", err) } s.ReplyTo = value } { value, err := DecodeInputMedia(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field media: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field media: %w", err) } s.Media = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field message: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field message: %w", err) } s.Message = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field random_id: %w", err) } s.RandomID = value } if s.Flags.Has(2) { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field reply_markup: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field reply_markup: %w", err) } s.ReplyMarkup = value } if s.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field entities: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field entities: %w", err) } if headerLen > 0 { @@ -513,7 +541,7 @@ func (s *MessagesSendMediaRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field entities: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -521,17 +549,24 @@ func (s *MessagesSendMediaRequest) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field schedule_date: %w", err) } s.ScheduleDate = value } if s.Flags.Has(13) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMedia#72ccc23d: field send_as: %w", err) + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field send_as: %w", err) } s.SendAs = value } + if s.Flags.Has(17) { + value, err := DecodeInputQuickReplyShortcut(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendMedia#7bd66041: field quick_reply_shortcut: %w", err) + } + s.QuickReplyShortcut = value + } return nil } @@ -771,6 +806,24 @@ func (s *MessagesSendMediaRequest) GetSendAs() (value InputPeerClass, ok bool) { return s.SendAs, true } +// SetQuickReplyShortcut sets value of QuickReplyShortcut conditional field. +func (s *MessagesSendMediaRequest) SetQuickReplyShortcut(value InputQuickReplyShortcutClass) { + s.Flags.Set(17) + s.QuickReplyShortcut = value +} + +// GetQuickReplyShortcut returns value of QuickReplyShortcut conditional field and +// boolean which is true if field was set. +func (s *MessagesSendMediaRequest) GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(17) { + return value, false + } + return s.QuickReplyShortcut, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, ok bool) { if !s.Flags.Has(3) { @@ -779,7 +832,7 @@ func (s *MessagesSendMediaRequest) MapEntities() (value MessageEntityClassArray, return MessageEntityClassArray(s.Entities), true } -// MessagesSendMedia invokes method messages.sendMedia#72ccc23d returning error if any. +// MessagesSendMedia invokes method messages.sendMedia#7bd66041 returning error if any. // Send a media // // Possible errors: diff --git a/tg/tl_messages_send_message_gen.go b/tg/tl_messages_send_message_gen.go index 982a3e0432..c5c49ed215 100644 --- a/tg/tl_messages_send_message_gen.go +++ b/tg/tl_messages_send_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSendMessageRequest represents TL type `messages.sendMessage#280d096f`. +// MessagesSendMessageRequest represents TL type `messages.sendMessage#dff8042c`. // Sends a message to a chat // // See https://core.telegram.org/method/messages.sendMessage for reference. @@ -96,10 +96,14 @@ type MessagesSendMessageRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass + // QuickReplyShortcut field of MessagesSendMessageRequest. + // + // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. + QuickReplyShortcut InputQuickReplyShortcutClass } // MessagesSendMessageRequestTypeID is TL type id of MessagesSendMessageRequest. -const MessagesSendMessageRequestTypeID = 0x280d096f +const MessagesSendMessageRequestTypeID = 0xdff8042c // Ensuring interfaces in compile-time for MessagesSendMessageRequest. var ( @@ -161,6 +165,9 @@ func (s *MessagesSendMessageRequest) Zero() bool { if !(s.SendAs == nil) { return false } + if !(s.QuickReplyShortcut == nil) { + return false + } return true } @@ -191,6 +198,7 @@ func (s *MessagesSendMessageRequest) FillFrom(from interface { GetEntities() (value []MessageEntityClass, ok bool) GetScheduleDate() (value int, ok bool) GetSendAs() (value InputPeerClass, ok bool) + GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) }) { s.NoWebpage = from.GetNoWebpage() s.Silent = from.GetSilent() @@ -222,6 +230,10 @@ func (s *MessagesSendMessageRequest) FillFrom(from interface { s.SendAs = val } + if val, ok := from.GetQuickReplyShortcut(); ok { + s.QuickReplyShortcut = val + } + } // TypeID returns type id in TL schema. @@ -319,6 +331,11 @@ func (s *MessagesSendMessageRequest) TypeInfo() tdp.Type { SchemaName: "send_as", Null: !s.Flags.Has(13), }, + { + Name: "QuickReplyShortcut", + SchemaName: "quick_reply_shortcut", + Null: !s.Flags.Has(17), + }, } return typ } @@ -361,12 +378,15 @@ func (s *MessagesSendMessageRequest) SetFlags() { if !(s.SendAs == nil) { s.Flags.Set(13) } + if !(s.QuickReplyShortcut == nil) { + s.Flags.Set(17) + } } // Encode implements bin.Encoder. func (s *MessagesSendMessageRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendMessage#280d096f as nil") + return fmt.Errorf("can't encode messages.sendMessage#dff8042c as nil") } b.PutID(MessagesSendMessageRequestTypeID) return s.EncodeBare(b) @@ -375,44 +395,44 @@ func (s *MessagesSendMessageRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSendMessageRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendMessage#280d096f as nil") + return fmt.Errorf("can't encode messages.sendMessage#dff8042c as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field flags: %w", err) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field peer is nil") + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field peer: %w", err) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field peer: %w", err) } if s.Flags.Has(0) { if s.ReplyTo == nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field reply_to is nil") + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field reply_to is nil") } if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field reply_to: %w", err) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field reply_to: %w", err) } } b.PutString(s.Message) b.PutLong(s.RandomID) if s.Flags.Has(2) { if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field reply_markup is nil") + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field reply_markup is nil") } if err := s.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field reply_markup: %w", err) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field reply_markup: %w", err) } } if s.Flags.Has(3) { b.PutVectorHeader(len(s.Entities)) for idx, v := range s.Entities { if v == nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field entities element with index %d: %w", idx, err) } } } @@ -421,10 +441,18 @@ func (s *MessagesSendMessageRequest) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(13) { if s.SendAs == nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field send_as is nil") + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field send_as is nil") } if err := s.SendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMessage#280d096f: field send_as: %w", err) + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field send_as: %w", err) + } + } + if s.Flags.Has(17) { + if s.QuickReplyShortcut == nil { + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field quick_reply_shortcut is nil") + } + if err := s.QuickReplyShortcut.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendMessage#dff8042c: field quick_reply_shortcut: %w", err) } } return nil @@ -433,10 +461,10 @@ func (s *MessagesSendMessageRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *MessagesSendMessageRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendMessage#280d096f to nil") + return fmt.Errorf("can't decode messages.sendMessage#dff8042c to nil") } if err := b.ConsumeID(MessagesSendMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: %w", err) } return s.DecodeBare(b) } @@ -444,11 +472,11 @@ func (s *MessagesSendMessageRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSendMessageRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendMessage#280d096f to nil") + return fmt.Errorf("can't decode messages.sendMessage#dff8042c to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field flags: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field flags: %w", err) } } s.NoWebpage = s.Flags.Has(1) @@ -461,42 +489,42 @@ func (s *MessagesSendMessageRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field peer: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field peer: %w", err) } s.Peer = value } if s.Flags.Has(0) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field reply_to: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field reply_to: %w", err) } s.ReplyTo = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field message: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field message: %w", err) } s.Message = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field random_id: %w", err) } s.RandomID = value } if s.Flags.Has(2) { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field reply_markup: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field reply_markup: %w", err) } s.ReplyMarkup = value } if s.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field entities: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field entities: %w", err) } if headerLen > 0 { @@ -505,7 +533,7 @@ func (s *MessagesSendMessageRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field entities: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -513,17 +541,24 @@ func (s *MessagesSendMessageRequest) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field schedule_date: %w", err) } s.ScheduleDate = value } if s.Flags.Has(13) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMessage#280d096f: field send_as: %w", err) + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field send_as: %w", err) } s.SendAs = value } + if s.Flags.Has(17) { + value, err := DecodeInputQuickReplyShortcut(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendMessage#dff8042c: field quick_reply_shortcut: %w", err) + } + s.QuickReplyShortcut = value + } return nil } @@ -774,6 +809,24 @@ func (s *MessagesSendMessageRequest) GetSendAs() (value InputPeerClass, ok bool) return s.SendAs, true } +// SetQuickReplyShortcut sets value of QuickReplyShortcut conditional field. +func (s *MessagesSendMessageRequest) SetQuickReplyShortcut(value InputQuickReplyShortcutClass) { + s.Flags.Set(17) + s.QuickReplyShortcut = value +} + +// GetQuickReplyShortcut returns value of QuickReplyShortcut conditional field and +// boolean which is true if field was set. +func (s *MessagesSendMessageRequest) GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(17) { + return value, false + } + return s.QuickReplyShortcut, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArray, ok bool) { if !s.Flags.Has(3) { @@ -782,7 +835,7 @@ func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArra return MessageEntityClassArray(s.Entities), true } -// MessagesSendMessage invokes method messages.sendMessage#280d096f returning error if any. +// MessagesSendMessage invokes method messages.sendMessage#dff8042c returning error if any. // Sends a message to a chat // // Possible errors: diff --git a/tg/tl_messages_send_multi_media_gen.go b/tg/tl_messages_send_multi_media_gen.go index 84154be5e1..b1025b92e8 100644 --- a/tg/tl_messages_send_multi_media_gen.go +++ b/tg/tl_messages_send_multi_media_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSendMultiMediaRequest represents TL type `messages.sendMultiMedia#456e8987`. +// MessagesSendMultiMediaRequest represents TL type `messages.sendMultiMedia#c964709`. // Send an album or grouped media¹ // // Links: @@ -88,10 +88,14 @@ type MessagesSendMultiMediaRequest struct { // // Use SetSendAs and GetSendAs helpers. SendAs InputPeerClass + // QuickReplyShortcut field of MessagesSendMultiMediaRequest. + // + // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. + QuickReplyShortcut InputQuickReplyShortcutClass } // MessagesSendMultiMediaRequestTypeID is TL type id of MessagesSendMultiMediaRequest. -const MessagesSendMultiMediaRequestTypeID = 0x456e8987 +const MessagesSendMultiMediaRequestTypeID = 0xc964709 // Ensuring interfaces in compile-time for MessagesSendMultiMediaRequest. var ( @@ -141,6 +145,9 @@ func (s *MessagesSendMultiMediaRequest) Zero() bool { if !(s.SendAs == nil) { return false } + if !(s.QuickReplyShortcut == nil) { + return false + } return true } @@ -167,6 +174,7 @@ func (s *MessagesSendMultiMediaRequest) FillFrom(from interface { GetMultiMedia() (value []InputSingleMedia) GetScheduleDate() (value int, ok bool) GetSendAs() (value InputPeerClass, ok bool) + GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) }) { s.Silent = from.GetSilent() s.Background = from.GetBackground() @@ -188,6 +196,10 @@ func (s *MessagesSendMultiMediaRequest) FillFrom(from interface { s.SendAs = val } + if val, ok := from.GetQuickReplyShortcut(); ok { + s.QuickReplyShortcut = val + } + } // TypeID returns type id in TL schema. @@ -266,6 +278,11 @@ func (s *MessagesSendMultiMediaRequest) TypeInfo() tdp.Type { SchemaName: "send_as", Null: !s.Flags.Has(13), }, + { + Name: "QuickReplyShortcut", + SchemaName: "quick_reply_shortcut", + Null: !s.Flags.Has(17), + }, } return typ } @@ -299,12 +316,15 @@ func (s *MessagesSendMultiMediaRequest) SetFlags() { if !(s.SendAs == nil) { s.Flags.Set(13) } + if !(s.QuickReplyShortcut == nil) { + s.Flags.Set(17) + } } // Encode implements bin.Encoder. func (s *MessagesSendMultiMediaRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendMultiMedia#456e8987 as nil") + return fmt.Errorf("can't encode messages.sendMultiMedia#c964709 as nil") } b.PutID(MessagesSendMultiMediaRequestTypeID) return s.EncodeBare(b) @@ -313,30 +333,30 @@ func (s *MessagesSendMultiMediaRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSendMultiMediaRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendMultiMedia#456e8987 as nil") + return fmt.Errorf("can't encode messages.sendMultiMedia#c964709 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field flags: %w", err) + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field peer is nil") + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field peer: %w", err) + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field peer: %w", err) } if s.Flags.Has(0) { if s.ReplyTo == nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field reply_to is nil") + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field reply_to is nil") } if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field reply_to: %w", err) + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field reply_to: %w", err) } } b.PutVectorHeader(len(s.MultiMedia)) for idx, v := range s.MultiMedia { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field multi_media element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field multi_media element with index %d: %w", idx, err) } } if s.Flags.Has(10) { @@ -344,10 +364,18 @@ func (s *MessagesSendMultiMediaRequest) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(13) { if s.SendAs == nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field send_as is nil") + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field send_as is nil") } if err := s.SendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendMultiMedia#456e8987: field send_as: %w", err) + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field send_as: %w", err) + } + } + if s.Flags.Has(17) { + if s.QuickReplyShortcut == nil { + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field quick_reply_shortcut is nil") + } + if err := s.QuickReplyShortcut.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendMultiMedia#c964709: field quick_reply_shortcut: %w", err) } } return nil @@ -356,10 +384,10 @@ func (s *MessagesSendMultiMediaRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *MessagesSendMultiMediaRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendMultiMedia#456e8987 to nil") + return fmt.Errorf("can't decode messages.sendMultiMedia#c964709 to nil") } if err := b.ConsumeID(MessagesSendMultiMediaRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: %w", err) } return s.DecodeBare(b) } @@ -367,11 +395,11 @@ func (s *MessagesSendMultiMediaRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSendMultiMediaRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendMultiMedia#456e8987 to nil") + return fmt.Errorf("can't decode messages.sendMultiMedia#c964709 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field flags: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field flags: %w", err) } } s.Silent = s.Flags.Has(5) @@ -383,21 +411,21 @@ func (s *MessagesSendMultiMediaRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field peer: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field peer: %w", err) } s.Peer = value } if s.Flags.Has(0) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field reply_to: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field reply_to: %w", err) } s.ReplyTo = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field multi_media: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field multi_media: %w", err) } if headerLen > 0 { @@ -406,7 +434,7 @@ func (s *MessagesSendMultiMediaRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value InputSingleMedia if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field multi_media: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field multi_media: %w", err) } s.MultiMedia = append(s.MultiMedia, value) } @@ -414,17 +442,24 @@ func (s *MessagesSendMultiMediaRequest) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field schedule_date: %w", err) } s.ScheduleDate = value } if s.Flags.Has(13) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendMultiMedia#456e8987: field send_as: %w", err) + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field send_as: %w", err) } s.SendAs = value } + if s.Flags.Has(17) { + value, err := DecodeInputQuickReplyShortcut(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendMultiMedia#c964709: field quick_reply_shortcut: %w", err) + } + s.QuickReplyShortcut = value + } return nil } @@ -612,7 +647,25 @@ func (s *MessagesSendMultiMediaRequest) GetSendAs() (value InputPeerClass, ok bo return s.SendAs, true } -// MessagesSendMultiMedia invokes method messages.sendMultiMedia#456e8987 returning error if any. +// SetQuickReplyShortcut sets value of QuickReplyShortcut conditional field. +func (s *MessagesSendMultiMediaRequest) SetQuickReplyShortcut(value InputQuickReplyShortcutClass) { + s.Flags.Set(17) + s.QuickReplyShortcut = value +} + +// GetQuickReplyShortcut returns value of QuickReplyShortcut conditional field and +// boolean which is true if field was set. +func (s *MessagesSendMultiMediaRequest) GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(17) { + return value, false + } + return s.QuickReplyShortcut, true +} + +// MessagesSendMultiMedia invokes method messages.sendMultiMedia#c964709 returning error if any. // Send an album or grouped media¹ // // Links: diff --git a/tg/tl_messages_send_quick_reply_messages_gen.go b/tg/tl_messages_send_quick_reply_messages_gen.go new file mode 100644 index 0000000000..e476c7636d --- /dev/null +++ b/tg/tl_messages_send_quick_reply_messages_gen.go @@ -0,0 +1,205 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesSendQuickReplyMessagesRequest represents TL type `messages.sendQuickReplyMessages#33153ad4`. +// +// See https://core.telegram.org/method/messages.sendQuickReplyMessages for reference. +type MessagesSendQuickReplyMessagesRequest struct { + // Peer field of MessagesSendQuickReplyMessagesRequest. + Peer InputPeerClass + // ShortcutID field of MessagesSendQuickReplyMessagesRequest. + ShortcutID int +} + +// MessagesSendQuickReplyMessagesRequestTypeID is TL type id of MessagesSendQuickReplyMessagesRequest. +const MessagesSendQuickReplyMessagesRequestTypeID = 0x33153ad4 + +// Ensuring interfaces in compile-time for MessagesSendQuickReplyMessagesRequest. +var ( + _ bin.Encoder = &MessagesSendQuickReplyMessagesRequest{} + _ bin.Decoder = &MessagesSendQuickReplyMessagesRequest{} + _ bin.BareEncoder = &MessagesSendQuickReplyMessagesRequest{} + _ bin.BareDecoder = &MessagesSendQuickReplyMessagesRequest{} +) + +func (s *MessagesSendQuickReplyMessagesRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Peer == nil) { + return false + } + if !(s.ShortcutID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *MessagesSendQuickReplyMessagesRequest) String() string { + if s == nil { + return "MessagesSendQuickReplyMessagesRequest(nil)" + } + type Alias MessagesSendQuickReplyMessagesRequest + return fmt.Sprintf("MessagesSendQuickReplyMessagesRequest%+v", Alias(*s)) +} + +// FillFrom fills MessagesSendQuickReplyMessagesRequest from given interface. +func (s *MessagesSendQuickReplyMessagesRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetShortcutID() (value int) +}) { + s.Peer = from.GetPeer() + s.ShortcutID = from.GetShortcutID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesSendQuickReplyMessagesRequest) TypeID() uint32 { + return MessagesSendQuickReplyMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesSendQuickReplyMessagesRequest) TypeName() string { + return "messages.sendQuickReplyMessages" +} + +// TypeInfo returns info about TL type. +func (s *MessagesSendQuickReplyMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.sendQuickReplyMessages", + ID: MessagesSendQuickReplyMessagesRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *MessagesSendQuickReplyMessagesRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.sendQuickReplyMessages#33153ad4 as nil") + } + b.PutID(MessagesSendQuickReplyMessagesRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *MessagesSendQuickReplyMessagesRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.sendQuickReplyMessages#33153ad4 as nil") + } + if s.Peer == nil { + return fmt.Errorf("unable to encode messages.sendQuickReplyMessages#33153ad4: field peer is nil") + } + if err := s.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendQuickReplyMessages#33153ad4: field peer: %w", err) + } + b.PutInt(s.ShortcutID) + return nil +} + +// Decode implements bin.Decoder. +func (s *MessagesSendQuickReplyMessagesRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.sendQuickReplyMessages#33153ad4 to nil") + } + if err := b.ConsumeID(MessagesSendQuickReplyMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.sendQuickReplyMessages#33153ad4: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *MessagesSendQuickReplyMessagesRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.sendQuickReplyMessages#33153ad4 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendQuickReplyMessages#33153ad4: field peer: %w", err) + } + s.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.sendQuickReplyMessages#33153ad4: field shortcut_id: %w", err) + } + s.ShortcutID = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (s *MessagesSendQuickReplyMessagesRequest) GetPeer() (value InputPeerClass) { + if s == nil { + return + } + return s.Peer +} + +// GetShortcutID returns value of ShortcutID field. +func (s *MessagesSendQuickReplyMessagesRequest) GetShortcutID() (value int) { + if s == nil { + return + } + return s.ShortcutID +} + +// MessagesSendQuickReplyMessages invokes method messages.sendQuickReplyMessages#33153ad4 returning error if any. +// +// See https://core.telegram.org/method/messages.sendQuickReplyMessages for reference. +func (c *Client) MessagesSendQuickReplyMessages(ctx context.Context, request *MessagesSendQuickReplyMessagesRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/tg/tl_messages_send_quick_reply_messages_slices_gen.go b/tg/tl_messages_send_quick_reply_messages_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_send_quick_reply_messages_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_toggle_dialog_filter_tags_gen.go b/tg/tl_messages_toggle_dialog_filter_tags_gen.go new file mode 100644 index 0000000000..2d07138fcf --- /dev/null +++ b/tg/tl_messages_toggle_dialog_filter_tags_gen.go @@ -0,0 +1,177 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesToggleDialogFilterTagsRequest represents TL type `messages.toggleDialogFilterTags#fd2dda49`. +// +// See https://core.telegram.org/method/messages.toggleDialogFilterTags for reference. +type MessagesToggleDialogFilterTagsRequest struct { + // Enabled field of MessagesToggleDialogFilterTagsRequest. + Enabled bool +} + +// MessagesToggleDialogFilterTagsRequestTypeID is TL type id of MessagesToggleDialogFilterTagsRequest. +const MessagesToggleDialogFilterTagsRequestTypeID = 0xfd2dda49 + +// Ensuring interfaces in compile-time for MessagesToggleDialogFilterTagsRequest. +var ( + _ bin.Encoder = &MessagesToggleDialogFilterTagsRequest{} + _ bin.Decoder = &MessagesToggleDialogFilterTagsRequest{} + _ bin.BareEncoder = &MessagesToggleDialogFilterTagsRequest{} + _ bin.BareDecoder = &MessagesToggleDialogFilterTagsRequest{} +) + +func (t *MessagesToggleDialogFilterTagsRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Enabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *MessagesToggleDialogFilterTagsRequest) String() string { + if t == nil { + return "MessagesToggleDialogFilterTagsRequest(nil)" + } + type Alias MessagesToggleDialogFilterTagsRequest + return fmt.Sprintf("MessagesToggleDialogFilterTagsRequest%+v", Alias(*t)) +} + +// FillFrom fills MessagesToggleDialogFilterTagsRequest from given interface. +func (t *MessagesToggleDialogFilterTagsRequest) FillFrom(from interface { + GetEnabled() (value bool) +}) { + t.Enabled = from.GetEnabled() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesToggleDialogFilterTagsRequest) TypeID() uint32 { + return MessagesToggleDialogFilterTagsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesToggleDialogFilterTagsRequest) TypeName() string { + return "messages.toggleDialogFilterTags" +} + +// TypeInfo returns info about TL type. +func (t *MessagesToggleDialogFilterTagsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.toggleDialogFilterTags", + ID: MessagesToggleDialogFilterTagsRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Enabled", + SchemaName: "enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *MessagesToggleDialogFilterTagsRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode messages.toggleDialogFilterTags#fd2dda49 as nil") + } + b.PutID(MessagesToggleDialogFilterTagsRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *MessagesToggleDialogFilterTagsRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode messages.toggleDialogFilterTags#fd2dda49 as nil") + } + b.PutBool(t.Enabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *MessagesToggleDialogFilterTagsRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode messages.toggleDialogFilterTags#fd2dda49 to nil") + } + if err := b.ConsumeID(MessagesToggleDialogFilterTagsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.toggleDialogFilterTags#fd2dda49: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *MessagesToggleDialogFilterTagsRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode messages.toggleDialogFilterTags#fd2dda49 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messages.toggleDialogFilterTags#fd2dda49: field enabled: %w", err) + } + t.Enabled = value + } + return nil +} + +// GetEnabled returns value of Enabled field. +func (t *MessagesToggleDialogFilterTagsRequest) GetEnabled() (value bool) { + if t == nil { + return + } + return t.Enabled +} + +// MessagesToggleDialogFilterTags invokes method messages.toggleDialogFilterTags#fd2dda49 returning error if any. +// +// See https://core.telegram.org/method/messages.toggleDialogFilterTags for reference. +func (c *Client) MessagesToggleDialogFilterTags(ctx context.Context, enabled bool) (bool, error) { + var result BoolBox + + request := &MessagesToggleDialogFilterTagsRequest{ + Enabled: enabled, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_messages_toggle_dialog_filter_tags_slices_gen.go b/tg/tl_messages_toggle_dialog_filter_tags_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_toggle_dialog_filter_tags_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_quick_reply_gen.go b/tg/tl_quick_reply_gen.go new file mode 100644 index 0000000000..97859a2ebb --- /dev/null +++ b/tg/tl_quick_reply_gen.go @@ -0,0 +1,242 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// QuickReply represents TL type `quickReply#697102b`. +// +// See https://core.telegram.org/constructor/quickReply for reference. +type QuickReply struct { + // ShortcutID field of QuickReply. + ShortcutID int + // Shortcut field of QuickReply. + Shortcut string + // TopMessage field of QuickReply. + TopMessage int + // Count field of QuickReply. + Count int +} + +// QuickReplyTypeID is TL type id of QuickReply. +const QuickReplyTypeID = 0x697102b + +// Ensuring interfaces in compile-time for QuickReply. +var ( + _ bin.Encoder = &QuickReply{} + _ bin.Decoder = &QuickReply{} + _ bin.BareEncoder = &QuickReply{} + _ bin.BareDecoder = &QuickReply{} +) + +func (q *QuickReply) Zero() bool { + if q == nil { + return true + } + if !(q.ShortcutID == 0) { + return false + } + if !(q.Shortcut == "") { + return false + } + if !(q.TopMessage == 0) { + return false + } + if !(q.Count == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (q *QuickReply) String() string { + if q == nil { + return "QuickReply(nil)" + } + type Alias QuickReply + return fmt.Sprintf("QuickReply%+v", Alias(*q)) +} + +// FillFrom fills QuickReply from given interface. +func (q *QuickReply) FillFrom(from interface { + GetShortcutID() (value int) + GetShortcut() (value string) + GetTopMessage() (value int) + GetCount() (value int) +}) { + q.ShortcutID = from.GetShortcutID() + q.Shortcut = from.GetShortcut() + q.TopMessage = from.GetTopMessage() + q.Count = from.GetCount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*QuickReply) TypeID() uint32 { + return QuickReplyTypeID +} + +// TypeName returns name of type in TL schema. +func (*QuickReply) TypeName() string { + return "quickReply" +} + +// TypeInfo returns info about TL type. +func (q *QuickReply) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "quickReply", + ID: QuickReplyTypeID, + } + if q == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Shortcut", + SchemaName: "shortcut", + }, + { + Name: "TopMessage", + SchemaName: "top_message", + }, + { + Name: "Count", + SchemaName: "count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (q *QuickReply) Encode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode quickReply#697102b as nil") + } + b.PutID(QuickReplyTypeID) + return q.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (q *QuickReply) EncodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't encode quickReply#697102b as nil") + } + b.PutInt(q.ShortcutID) + b.PutString(q.Shortcut) + b.PutInt(q.TopMessage) + b.PutInt(q.Count) + return nil +} + +// Decode implements bin.Decoder. +func (q *QuickReply) Decode(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode quickReply#697102b to nil") + } + if err := b.ConsumeID(QuickReplyTypeID); err != nil { + return fmt.Errorf("unable to decode quickReply#697102b: %w", err) + } + return q.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (q *QuickReply) DecodeBare(b *bin.Buffer) error { + if q == nil { + return fmt.Errorf("can't decode quickReply#697102b to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode quickReply#697102b: field shortcut_id: %w", err) + } + q.ShortcutID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode quickReply#697102b: field shortcut: %w", err) + } + q.Shortcut = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode quickReply#697102b: field top_message: %w", err) + } + q.TopMessage = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode quickReply#697102b: field count: %w", err) + } + q.Count = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (q *QuickReply) GetShortcutID() (value int) { + if q == nil { + return + } + return q.ShortcutID +} + +// GetShortcut returns value of Shortcut field. +func (q *QuickReply) GetShortcut() (value string) { + if q == nil { + return + } + return q.Shortcut +} + +// GetTopMessage returns value of TopMessage field. +func (q *QuickReply) GetTopMessage() (value int) { + if q == nil { + return + } + return q.TopMessage +} + +// GetCount returns value of Count field. +func (q *QuickReply) GetCount() (value int) { + if q == nil { + return + } + return q.Count +} diff --git a/tg/tl_quick_reply_slices_gen.go b/tg/tl_quick_reply_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_quick_reply_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index 98e6ff4545..918aba1ccb 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 174 +const Layer = 176 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -128,7 +128,7 @@ func TypesMap() map[uint32]string { ChatPhotoEmptyTypeID: "chatPhotoEmpty#37c1011c", ChatPhotoTypeID: "chatPhoto#1c6e1c11", MessageEmptyTypeID: "messageEmpty#90a6ca84", - MessageTypeID: "message#1e4c8a69", + MessageTypeID: "message#a66c7efc", MessageServiceTypeID: "messageService#2b085862", MessageMediaEmptyTypeID: "messageMediaEmpty#3ded6320", MessageMediaPhotoTypeID: "messageMediaPhoto#695150d7", @@ -225,7 +225,7 @@ func TypesMap() map[uint32]string { InputReportReasonFakeTypeID: "inputReportReasonFake#f5ddd6e7", InputReportReasonIllegalDrugsTypeID: "inputReportReasonIllegalDrugs#a8eb2be", InputReportReasonPersonalDetailsTypeID: "inputReportReasonPersonalDetails#9ec7863d", - UserFullTypeID: "userFull#b9b12c6c", + UserFullTypeID: "userFull#22ff3e85", ContactTypeID: "contact#145ade0b", ImportedContactTypeID: "importedContact#c13e3c50", ContactStatusTypeID: "contactStatus#16d9703b", @@ -387,6 +387,12 @@ func TypesMap() map[uint32]string { UpdateSavedDialogPinnedTypeID: "updateSavedDialogPinned#aeaf9e74", UpdatePinnedSavedDialogsTypeID: "updatePinnedSavedDialogs#686c85a6", UpdateSavedReactionTagsTypeID: "updateSavedReactionTags#39c67432", + UpdateSMSJobTypeID: "updateSmsJob#f16269d4", + UpdateQuickRepliesTypeID: "updateQuickReplies#f9470ab2", + UpdateNewQuickReplyTypeID: "updateNewQuickReply#f53da717", + UpdateDeleteQuickReplyTypeID: "updateDeleteQuickReply#53e6f1ec", + UpdateQuickReplyMessageTypeID: "updateQuickReplyMessage#3e050d0f", + UpdateDeleteQuickReplyMessagesTypeID: "updateDeleteQuickReplyMessages#566fe7cd", UpdatesStateTypeID: "updates.state#a56c2a3e", UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138", UpdatesDifferenceTypeID: "updates.difference#f49ca0", @@ -993,9 +999,9 @@ func TypesMap() map[uint32]string { MessagesVotesListTypeID: "messages.votesList#4899484e", BankCardOpenURLTypeID: "bankCardOpenUrl#f568028a", PaymentsBankCardDataTypeID: "payments.bankCardData#3e24e573", - DialogFilterTypeID: "dialogFilter#7438f7e8", + DialogFilterTypeID: "dialogFilter#5fb5523b", DialogFilterDefaultTypeID: "dialogFilterDefault#363293ae", - DialogFilterChatlistTypeID: "dialogFilterChatlist#d64a04a8", + DialogFilterChatlistTypeID: "dialogFilterChatlist#9fe28ea4", DialogFilterSuggestedTypeID: "dialogFilterSuggested#77744d4a", StatsDateRangeDaysTypeID: "statsDateRangeDays#b637edaf", StatsAbsValueAndPrevTypeID: "statsAbsValueAndPrev#cb43acde", @@ -1250,6 +1256,32 @@ func TypesMap() map[uint32]string { MessagesSavedReactionTagsNotModifiedTypeID: "messages.savedReactionTagsNotModified#889b59ef", MessagesSavedReactionTagsTypeID: "messages.savedReactionTags#3259950a", OutboxReadDateTypeID: "outboxReadDate#3bb842ac", + SMSJobsEligibleToJoinTypeID: "smsjobs.eligibleToJoin#dc8b44cf", + SMSJobsStatusTypeID: "smsjobs.status#2aee9191", + SMSJobTypeID: "smsJob#e6a1eeb8", + BusinessWeeklyOpenTypeID: "businessWeeklyOpen#120b1ab9", + BusinessWorkHoursTypeID: "businessWorkHours#8c92b098", + BusinessLocationTypeID: "businessLocation#ac5c1af7", + InputBusinessRecipientsTypeID: "inputBusinessRecipients#6f8b32aa", + BusinessRecipientsTypeID: "businessRecipients#21108ff7", + BusinessAwayMessageScheduleAlwaysTypeID: "businessAwayMessageScheduleAlways#c9b9e2b9", + BusinessAwayMessageScheduleOutsideWorkHoursTypeID: "businessAwayMessageScheduleOutsideWorkHours#c3f2f501", + BusinessAwayMessageScheduleCustomTypeID: "businessAwayMessageScheduleCustom#cc4d9ecc", + InputBusinessGreetingMessageTypeID: "inputBusinessGreetingMessage#194cb3b", + BusinessGreetingMessageTypeID: "businessGreetingMessage#e519abab", + InputBusinessAwayMessageTypeID: "inputBusinessAwayMessage#832175e0", + BusinessAwayMessageTypeID: "businessAwayMessage#ef156a5c", + TimezoneTypeID: "timezone#ff9289f5", + HelpTimezonesListNotModifiedTypeID: "help.timezonesListNotModified#970708cc", + HelpTimezonesListTypeID: "help.timezonesList#7b74ed71", + QuickReplyTypeID: "quickReply#697102b", + InputQuickReplyShortcutTypeID: "inputQuickReplyShortcut#24596d41", + InputQuickReplyShortcutIDTypeID: "inputQuickReplyShortcutId#1190cf1", + MessagesQuickRepliesTypeID: "messages.quickReplies#c68d6695", + MessagesQuickRepliesNotModifiedTypeID: "messages.quickRepliesNotModified#5f91eb5b", + ConnectedBotTypeID: "connectedBot#e7e999e7", + AccountConnectedBotsTypeID: "account.connectedBots#17d7f87b", + MessagesDialogFiltersTypeID: "messages.dialogFilters#2ad93719", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1371,6 +1403,12 @@ func TypesMap() map[uint32]string { AccountGetDefaultBackgroundEmojisRequestTypeID: "account.getDefaultBackgroundEmojis#a60ab9ce", AccountGetChannelDefaultEmojiStatusesRequestTypeID: "account.getChannelDefaultEmojiStatuses#7727a7d5", AccountGetChannelRestrictedStatusEmojisRequestTypeID: "account.getChannelRestrictedStatusEmojis#35a9e0d5", + AccountUpdateBusinessWorkHoursRequestTypeID: "account.updateBusinessWorkHours#4b00e066", + AccountUpdateBusinessLocationRequestTypeID: "account.updateBusinessLocation#9e6b131a", + AccountUpdateBusinessGreetingMessageRequestTypeID: "account.updateBusinessGreetingMessage#66cdafc4", + AccountUpdateBusinessAwayMessageRequestTypeID: "account.updateBusinessAwayMessage#a26a7fa5", + AccountUpdateConnectedBotRequestTypeID: "account.updateConnectedBot#9c2d527d", + AccountGetConnectedBotsRequestTypeID: "account.getConnectedBots#4ea4c80f", UsersGetUsersRequestTypeID: "users.getUsers#d91a548", UsersGetFullUserRequestTypeID: "users.getFullUser#b60f5918", UsersSetSecureValueErrorsRequestTypeID: "users.setSecureValueErrors#90c894b5", @@ -1409,9 +1447,9 @@ func TypesMap() map[uint32]string { MessagesDeleteMessagesRequestTypeID: "messages.deleteMessages#e58e95d2", MessagesReceivedMessagesRequestTypeID: "messages.receivedMessages#5a954c0", MessagesSetTypingRequestTypeID: "messages.setTyping#58943ee2", - MessagesSendMessageRequestTypeID: "messages.sendMessage#280d096f", - MessagesSendMediaRequestTypeID: "messages.sendMedia#72ccc23d", - MessagesForwardMessagesRequestTypeID: "messages.forwardMessages#c661bbc4", + MessagesSendMessageRequestTypeID: "messages.sendMessage#dff8042c", + MessagesSendMediaRequestTypeID: "messages.sendMedia#7bd66041", + MessagesForwardMessagesRequestTypeID: "messages.forwardMessages#d5039208", MessagesReportSpamRequestTypeID: "messages.reportSpam#cf1592db", MessagesGetPeerSettingsRequestTypeID: "messages.getPeerSettings#efd9a6a2", MessagesReportRequestTypeID: "messages.report#8953ab4e", @@ -1454,9 +1492,9 @@ func TypesMap() map[uint32]string { MessagesSaveGifRequestTypeID: "messages.saveGif#327a30cb", MessagesGetInlineBotResultsRequestTypeID: "messages.getInlineBotResults#514e999d", MessagesSetInlineBotResultsRequestTypeID: "messages.setInlineBotResults#bb12a419", - MessagesSendInlineBotResultRequestTypeID: "messages.sendInlineBotResult#f7bc68ba", + MessagesSendInlineBotResultRequestTypeID: "messages.sendInlineBotResult#3ebee86a", MessagesGetMessageEditDataRequestTypeID: "messages.getMessageEditData#fda68d36", - MessagesEditMessageRequestTypeID: "messages.editMessage#48f71778", + MessagesEditMessageRequestTypeID: "messages.editMessage#dfd14005", MessagesEditInlineBotMessageRequestTypeID: "messages.editInlineBotMessage#83557dba", MessagesGetBotCallbackAnswerRequestTypeID: "messages.getBotCallbackAnswer#9342ca07", MessagesSetBotCallbackAnswerRequestTypeID: "messages.setBotCallbackAnswer#d58f130a", @@ -1489,7 +1527,7 @@ func TypesMap() map[uint32]string { MessagesGetUnreadMentionsRequestTypeID: "messages.getUnreadMentions#f107e790", MessagesReadMentionsRequestTypeID: "messages.readMentions#36e5bf4d", MessagesGetRecentLocationsRequestTypeID: "messages.getRecentLocations#702a40e0", - MessagesSendMultiMediaRequestTypeID: "messages.sendMultiMedia#456e8987", + MessagesSendMultiMediaRequestTypeID: "messages.sendMultiMedia#c964709", MessagesUploadEncryptedFileRequestTypeID: "messages.uploadEncryptedFile#5057c497", MessagesSearchStickerSetsRequestTypeID: "messages.searchStickerSets#35705b8a", MessagesGetSplitRangesRequestTypeID: "messages.getSplitRanges#1cff7e08", @@ -1516,7 +1554,7 @@ func TypesMap() map[uint32]string { MessagesDeleteScheduledMessagesRequestTypeID: "messages.deleteScheduledMessages#59ae2b16", MessagesGetPollVotesRequestTypeID: "messages.getPollVotes#b86e380e", MessagesToggleStickerSetsRequestTypeID: "messages.toggleStickerSets#b5052fea", - MessagesGetDialogFiltersRequestTypeID: "messages.getDialogFilters#f19ed96d", + MessagesGetDialogFiltersRequestTypeID: "messages.getDialogFilters#efd48c89", MessagesGetSuggestedDialogFiltersRequestTypeID: "messages.getSuggestedDialogFilters#a29cd42c", MessagesUpdateDialogFilterRequestTypeID: "messages.updateDialogFilter#1ad4a04a", MessagesUpdateDialogFiltersOrderRequestTypeID: "messages.updateDialogFiltersOrder#c563c1e4", @@ -1598,6 +1636,15 @@ func TypesMap() map[uint32]string { MessagesUpdateSavedReactionTagRequestTypeID: "messages.updateSavedReactionTag#60297dec", MessagesGetDefaultTagReactionsRequestTypeID: "messages.getDefaultTagReactions#bdf93428", MessagesGetOutboxReadDateRequestTypeID: "messages.getOutboxReadDate#8c4bfe5d", + MessagesGetQuickRepliesRequestTypeID: "messages.getQuickReplies#d483f2a8", + MessagesReorderQuickRepliesRequestTypeID: "messages.reorderQuickReplies#60331907", + MessagesCheckQuickReplyShortcutRequestTypeID: "messages.checkQuickReplyShortcut#f1d0fbd3", + MessagesEditQuickReplyShortcutRequestTypeID: "messages.editQuickReplyShortcut#5c003cef", + MessagesDeleteQuickReplyShortcutRequestTypeID: "messages.deleteQuickReplyShortcut#3cc04740", + MessagesGetQuickReplyMessagesRequestTypeID: "messages.getQuickReplyMessages#94a495c3", + MessagesSendQuickReplyMessagesRequestTypeID: "messages.sendQuickReplyMessages#33153ad4", + MessagesDeleteQuickReplyMessagesRequestTypeID: "messages.deleteQuickReplyMessages#e105e910", + MessagesToggleDialogFilterTagsRequestTypeID: "messages.toggleDialogFilterTags#fd2dda49", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -1638,6 +1685,7 @@ func TypesMap() map[uint32]string { HelpGetPremiumPromoRequestTypeID: "help.getPremiumPromo#b81b93d4", HelpGetPeerColorsRequestTypeID: "help.getPeerColors#da80f42f", HelpGetPeerProfileColorsRequestTypeID: "help.getPeerProfileColors#abcfa9fd", + HelpGetTimezonesListRequestTypeID: "help.getTimezonesList#49b30240", ChannelsReadHistoryRequestTypeID: "channels.readHistory#cc104937", ChannelsDeleteMessagesRequestTypeID: "channels.deleteMessages#84c1fd4e", ChannelsReportSpamRequestTypeID: "channels.reportSpam#f44a8315", @@ -1826,6 +1874,13 @@ func TypesMap() map[uint32]string { PremiumApplyBoostRequestTypeID: "premium.applyBoost#6b7da746", PremiumGetBoostsStatusRequestTypeID: "premium.getBoostsStatus#42f1f61", PremiumGetUserBoostsRequestTypeID: "premium.getUserBoosts#39854d1f", + SMSJobsIsEligibleToJoinRequestTypeID: "smsjobs.isEligibleToJoin#edc39d0", + SMSJobsJoinRequestTypeID: "smsjobs.join#a74ece2d", + SMSJobsLeaveRequestTypeID: "smsjobs.leave#9898ad73", + SMSJobsUpdateSettingsRequestTypeID: "smsjobs.updateSettings#93fa0bf", + SMSJobsGetStatusRequestTypeID: "smsjobs.getStatus#10a698e8", + SMSJobsGetSMSJobRequestTypeID: "smsjobs.getSmsJob#778d902f", + SMSJobsFinishJobRequestTypeID: "smsjobs.finishJob#4f1ebf24", IntTypeID: "int#a8509bda", LongTypeID: "long#22076cba", DoubleTypeID: "double#2210c154", @@ -2195,6 +2250,12 @@ func NamesMap() map[string]uint32 { "updateSavedDialogPinned": UpdateSavedDialogPinnedTypeID, "updatePinnedSavedDialogs": UpdatePinnedSavedDialogsTypeID, "updateSavedReactionTags": UpdateSavedReactionTagsTypeID, + "updateSmsJob": UpdateSMSJobTypeID, + "updateQuickReplies": UpdateQuickRepliesTypeID, + "updateNewQuickReply": UpdateNewQuickReplyTypeID, + "updateDeleteQuickReply": UpdateDeleteQuickReplyTypeID, + "updateQuickReplyMessage": UpdateQuickReplyMessageTypeID, + "updateDeleteQuickReplyMessages": UpdateDeleteQuickReplyMessagesTypeID, "updates.state": UpdatesStateTypeID, "updates.differenceEmpty": UpdatesDifferenceEmptyTypeID, "updates.difference": UpdatesDifferenceTypeID, @@ -3058,6 +3119,32 @@ func NamesMap() map[string]uint32 { "messages.savedReactionTagsNotModified": MessagesSavedReactionTagsNotModifiedTypeID, "messages.savedReactionTags": MessagesSavedReactionTagsTypeID, "outboxReadDate": OutboxReadDateTypeID, + "smsjobs.eligibleToJoin": SMSJobsEligibleToJoinTypeID, + "smsjobs.status": SMSJobsStatusTypeID, + "smsJob": SMSJobTypeID, + "businessWeeklyOpen": BusinessWeeklyOpenTypeID, + "businessWorkHours": BusinessWorkHoursTypeID, + "businessLocation": BusinessLocationTypeID, + "inputBusinessRecipients": InputBusinessRecipientsTypeID, + "businessRecipients": BusinessRecipientsTypeID, + "businessAwayMessageScheduleAlways": BusinessAwayMessageScheduleAlwaysTypeID, + "businessAwayMessageScheduleOutsideWorkHours": BusinessAwayMessageScheduleOutsideWorkHoursTypeID, + "businessAwayMessageScheduleCustom": BusinessAwayMessageScheduleCustomTypeID, + "inputBusinessGreetingMessage": InputBusinessGreetingMessageTypeID, + "businessGreetingMessage": BusinessGreetingMessageTypeID, + "inputBusinessAwayMessage": InputBusinessAwayMessageTypeID, + "businessAwayMessage": BusinessAwayMessageTypeID, + "timezone": TimezoneTypeID, + "help.timezonesListNotModified": HelpTimezonesListNotModifiedTypeID, + "help.timezonesList": HelpTimezonesListTypeID, + "quickReply": QuickReplyTypeID, + "inputQuickReplyShortcut": InputQuickReplyShortcutTypeID, + "inputQuickReplyShortcutId": InputQuickReplyShortcutIDTypeID, + "messages.quickReplies": MessagesQuickRepliesTypeID, + "messages.quickRepliesNotModified": MessagesQuickRepliesNotModifiedTypeID, + "connectedBot": ConnectedBotTypeID, + "account.connectedBots": AccountConnectedBotsTypeID, + "messages.dialogFilters": MessagesDialogFiltersTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -3179,6 +3266,12 @@ func NamesMap() map[string]uint32 { "account.getDefaultBackgroundEmojis": AccountGetDefaultBackgroundEmojisRequestTypeID, "account.getChannelDefaultEmojiStatuses": AccountGetChannelDefaultEmojiStatusesRequestTypeID, "account.getChannelRestrictedStatusEmojis": AccountGetChannelRestrictedStatusEmojisRequestTypeID, + "account.updateBusinessWorkHours": AccountUpdateBusinessWorkHoursRequestTypeID, + "account.updateBusinessLocation": AccountUpdateBusinessLocationRequestTypeID, + "account.updateBusinessGreetingMessage": AccountUpdateBusinessGreetingMessageRequestTypeID, + "account.updateBusinessAwayMessage": AccountUpdateBusinessAwayMessageRequestTypeID, + "account.updateConnectedBot": AccountUpdateConnectedBotRequestTypeID, + "account.getConnectedBots": AccountGetConnectedBotsRequestTypeID, "users.getUsers": UsersGetUsersRequestTypeID, "users.getFullUser": UsersGetFullUserRequestTypeID, "users.setSecureValueErrors": UsersSetSecureValueErrorsRequestTypeID, @@ -3406,6 +3499,15 @@ func NamesMap() map[string]uint32 { "messages.updateSavedReactionTag": MessagesUpdateSavedReactionTagRequestTypeID, "messages.getDefaultTagReactions": MessagesGetDefaultTagReactionsRequestTypeID, "messages.getOutboxReadDate": MessagesGetOutboxReadDateRequestTypeID, + "messages.getQuickReplies": MessagesGetQuickRepliesRequestTypeID, + "messages.reorderQuickReplies": MessagesReorderQuickRepliesRequestTypeID, + "messages.checkQuickReplyShortcut": MessagesCheckQuickReplyShortcutRequestTypeID, + "messages.editQuickReplyShortcut": MessagesEditQuickReplyShortcutRequestTypeID, + "messages.deleteQuickReplyShortcut": MessagesDeleteQuickReplyShortcutRequestTypeID, + "messages.getQuickReplyMessages": MessagesGetQuickReplyMessagesRequestTypeID, + "messages.sendQuickReplyMessages": MessagesSendQuickReplyMessagesRequestTypeID, + "messages.deleteQuickReplyMessages": MessagesDeleteQuickReplyMessagesRequestTypeID, + "messages.toggleDialogFilterTags": MessagesToggleDialogFilterTagsRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -3446,6 +3548,7 @@ func NamesMap() map[string]uint32 { "help.getPremiumPromo": HelpGetPremiumPromoRequestTypeID, "help.getPeerColors": HelpGetPeerColorsRequestTypeID, "help.getPeerProfileColors": HelpGetPeerProfileColorsRequestTypeID, + "help.getTimezonesList": HelpGetTimezonesListRequestTypeID, "channels.readHistory": ChannelsReadHistoryRequestTypeID, "channels.deleteMessages": ChannelsDeleteMessagesRequestTypeID, "channels.reportSpam": ChannelsReportSpamRequestTypeID, @@ -3634,6 +3737,13 @@ func NamesMap() map[string]uint32 { "premium.applyBoost": PremiumApplyBoostRequestTypeID, "premium.getBoostsStatus": PremiumGetBoostsStatusRequestTypeID, "premium.getUserBoosts": PremiumGetUserBoostsRequestTypeID, + "smsjobs.isEligibleToJoin": SMSJobsIsEligibleToJoinRequestTypeID, + "smsjobs.join": SMSJobsJoinRequestTypeID, + "smsjobs.leave": SMSJobsLeaveRequestTypeID, + "smsjobs.updateSettings": SMSJobsUpdateSettingsRequestTypeID, + "smsjobs.getStatus": SMSJobsGetStatusRequestTypeID, + "smsjobs.getSmsJob": SMSJobsGetSMSJobRequestTypeID, + "smsjobs.finishJob": SMSJobsFinishJobRequestTypeID, "int": IntTypeID, "long": LongTypeID, "double": DoubleTypeID, @@ -4003,6 +4113,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateSavedDialogPinnedTypeID: func() bin.Object { return &UpdateSavedDialogPinned{} }, UpdatePinnedSavedDialogsTypeID: func() bin.Object { return &UpdatePinnedSavedDialogs{} }, UpdateSavedReactionTagsTypeID: func() bin.Object { return &UpdateSavedReactionTags{} }, + UpdateSMSJobTypeID: func() bin.Object { return &UpdateSMSJob{} }, + UpdateQuickRepliesTypeID: func() bin.Object { return &UpdateQuickReplies{} }, + UpdateNewQuickReplyTypeID: func() bin.Object { return &UpdateNewQuickReply{} }, + UpdateDeleteQuickReplyTypeID: func() bin.Object { return &UpdateDeleteQuickReply{} }, + UpdateQuickReplyMessageTypeID: func() bin.Object { return &UpdateQuickReplyMessage{} }, + UpdateDeleteQuickReplyMessagesTypeID: func() bin.Object { return &UpdateDeleteQuickReplyMessages{} }, UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} }, UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} }, UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} }, @@ -4866,6 +4982,32 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesSavedReactionTagsNotModifiedTypeID: func() bin.Object { return &MessagesSavedReactionTagsNotModified{} }, MessagesSavedReactionTagsTypeID: func() bin.Object { return &MessagesSavedReactionTags{} }, OutboxReadDateTypeID: func() bin.Object { return &OutboxReadDate{} }, + SMSJobsEligibleToJoinTypeID: func() bin.Object { return &SMSJobsEligibleToJoin{} }, + SMSJobsStatusTypeID: func() bin.Object { return &SMSJobsStatus{} }, + SMSJobTypeID: func() bin.Object { return &SMSJob{} }, + BusinessWeeklyOpenTypeID: func() bin.Object { return &BusinessWeeklyOpen{} }, + BusinessWorkHoursTypeID: func() bin.Object { return &BusinessWorkHours{} }, + BusinessLocationTypeID: func() bin.Object { return &BusinessLocation{} }, + InputBusinessRecipientsTypeID: func() bin.Object { return &InputBusinessRecipients{} }, + BusinessRecipientsTypeID: func() bin.Object { return &BusinessRecipients{} }, + BusinessAwayMessageScheduleAlwaysTypeID: func() bin.Object { return &BusinessAwayMessageScheduleAlways{} }, + BusinessAwayMessageScheduleOutsideWorkHoursTypeID: func() bin.Object { return &BusinessAwayMessageScheduleOutsideWorkHours{} }, + BusinessAwayMessageScheduleCustomTypeID: func() bin.Object { return &BusinessAwayMessageScheduleCustom{} }, + InputBusinessGreetingMessageTypeID: func() bin.Object { return &InputBusinessGreetingMessage{} }, + BusinessGreetingMessageTypeID: func() bin.Object { return &BusinessGreetingMessage{} }, + InputBusinessAwayMessageTypeID: func() bin.Object { return &InputBusinessAwayMessage{} }, + BusinessAwayMessageTypeID: func() bin.Object { return &BusinessAwayMessage{} }, + TimezoneTypeID: func() bin.Object { return &Timezone{} }, + HelpTimezonesListNotModifiedTypeID: func() bin.Object { return &HelpTimezonesListNotModified{} }, + HelpTimezonesListTypeID: func() bin.Object { return &HelpTimezonesList{} }, + QuickReplyTypeID: func() bin.Object { return &QuickReply{} }, + InputQuickReplyShortcutTypeID: func() bin.Object { return &InputQuickReplyShortcut{} }, + InputQuickReplyShortcutIDTypeID: func() bin.Object { return &InputQuickReplyShortcutID{} }, + MessagesQuickRepliesTypeID: func() bin.Object { return &MessagesQuickReplies{} }, + MessagesQuickRepliesNotModifiedTypeID: func() bin.Object { return &MessagesQuickRepliesNotModified{} }, + ConnectedBotTypeID: func() bin.Object { return &ConnectedBot{} }, + AccountConnectedBotsTypeID: func() bin.Object { return &AccountConnectedBots{} }, + MessagesDialogFiltersTypeID: func() bin.Object { return &MessagesDialogFilters{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -4987,6 +5129,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AccountGetDefaultBackgroundEmojisRequestTypeID: func() bin.Object { return &AccountGetDefaultBackgroundEmojisRequest{} }, AccountGetChannelDefaultEmojiStatusesRequestTypeID: func() bin.Object { return &AccountGetChannelDefaultEmojiStatusesRequest{} }, AccountGetChannelRestrictedStatusEmojisRequestTypeID: func() bin.Object { return &AccountGetChannelRestrictedStatusEmojisRequest{} }, + AccountUpdateBusinessWorkHoursRequestTypeID: func() bin.Object { return &AccountUpdateBusinessWorkHoursRequest{} }, + AccountUpdateBusinessLocationRequestTypeID: func() bin.Object { return &AccountUpdateBusinessLocationRequest{} }, + AccountUpdateBusinessGreetingMessageRequestTypeID: func() bin.Object { return &AccountUpdateBusinessGreetingMessageRequest{} }, + AccountUpdateBusinessAwayMessageRequestTypeID: func() bin.Object { return &AccountUpdateBusinessAwayMessageRequest{} }, + AccountUpdateConnectedBotRequestTypeID: func() bin.Object { return &AccountUpdateConnectedBotRequest{} }, + AccountGetConnectedBotsRequestTypeID: func() bin.Object { return &AccountGetConnectedBotsRequest{} }, UsersGetUsersRequestTypeID: func() bin.Object { return &UsersGetUsersRequest{} }, UsersGetFullUserRequestTypeID: func() bin.Object { return &UsersGetFullUserRequest{} }, UsersSetSecureValueErrorsRequestTypeID: func() bin.Object { return &UsersSetSecureValueErrorsRequest{} }, @@ -5214,6 +5362,15 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesUpdateSavedReactionTagRequestTypeID: func() bin.Object { return &MessagesUpdateSavedReactionTagRequest{} }, MessagesGetDefaultTagReactionsRequestTypeID: func() bin.Object { return &MessagesGetDefaultTagReactionsRequest{} }, MessagesGetOutboxReadDateRequestTypeID: func() bin.Object { return &MessagesGetOutboxReadDateRequest{} }, + MessagesGetQuickRepliesRequestTypeID: func() bin.Object { return &MessagesGetQuickRepliesRequest{} }, + MessagesReorderQuickRepliesRequestTypeID: func() bin.Object { return &MessagesReorderQuickRepliesRequest{} }, + MessagesCheckQuickReplyShortcutRequestTypeID: func() bin.Object { return &MessagesCheckQuickReplyShortcutRequest{} }, + MessagesEditQuickReplyShortcutRequestTypeID: func() bin.Object { return &MessagesEditQuickReplyShortcutRequest{} }, + MessagesDeleteQuickReplyShortcutRequestTypeID: func() bin.Object { return &MessagesDeleteQuickReplyShortcutRequest{} }, + MessagesGetQuickReplyMessagesRequestTypeID: func() bin.Object { return &MessagesGetQuickReplyMessagesRequest{} }, + MessagesSendQuickReplyMessagesRequestTypeID: func() bin.Object { return &MessagesSendQuickReplyMessagesRequest{} }, + MessagesDeleteQuickReplyMessagesRequestTypeID: func() bin.Object { return &MessagesDeleteQuickReplyMessagesRequest{} }, + MessagesToggleDialogFilterTagsRequestTypeID: func() bin.Object { return &MessagesToggleDialogFilterTagsRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -5254,6 +5411,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { HelpGetPremiumPromoRequestTypeID: func() bin.Object { return &HelpGetPremiumPromoRequest{} }, HelpGetPeerColorsRequestTypeID: func() bin.Object { return &HelpGetPeerColorsRequest{} }, HelpGetPeerProfileColorsRequestTypeID: func() bin.Object { return &HelpGetPeerProfileColorsRequest{} }, + HelpGetTimezonesListRequestTypeID: func() bin.Object { return &HelpGetTimezonesListRequest{} }, ChannelsReadHistoryRequestTypeID: func() bin.Object { return &ChannelsReadHistoryRequest{} }, ChannelsDeleteMessagesRequestTypeID: func() bin.Object { return &ChannelsDeleteMessagesRequest{} }, ChannelsReportSpamRequestTypeID: func() bin.Object { return &ChannelsReportSpamRequest{} }, @@ -5442,6 +5600,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumApplyBoostRequestTypeID: func() bin.Object { return &PremiumApplyBoostRequest{} }, PremiumGetBoostsStatusRequestTypeID: func() bin.Object { return &PremiumGetBoostsStatusRequest{} }, PremiumGetUserBoostsRequestTypeID: func() bin.Object { return &PremiumGetUserBoostsRequest{} }, + SMSJobsIsEligibleToJoinRequestTypeID: func() bin.Object { return &SMSJobsIsEligibleToJoinRequest{} }, + SMSJobsJoinRequestTypeID: func() bin.Object { return &SMSJobsJoinRequest{} }, + SMSJobsLeaveRequestTypeID: func() bin.Object { return &SMSJobsLeaveRequest{} }, + SMSJobsUpdateSettingsRequestTypeID: func() bin.Object { return &SMSJobsUpdateSettingsRequest{} }, + SMSJobsGetStatusRequestTypeID: func() bin.Object { return &SMSJobsGetStatusRequest{} }, + SMSJobsGetSMSJobRequestTypeID: func() bin.Object { return &SMSJobsGetSMSJobRequest{} }, + SMSJobsFinishJobRequestTypeID: func() bin.Object { return &SMSJobsFinishJobRequest{} }, IntTypeID: func() bin.Object { return &Int{} }, LongTypeID: func() bin.Object { return &Long{} }, DoubleTypeID: func() bin.Object { return &Double{} }, @@ -5574,6 +5739,11 @@ func ClassConstructorsMap() map[string][]uint32 { BotMenuButtonCommandsTypeID, BotMenuButtonTypeID, }, + BusinessAwayMessageScheduleClassName: { + BusinessAwayMessageScheduleAlwaysTypeID, + BusinessAwayMessageScheduleOutsideWorkHoursTypeID, + BusinessAwayMessageScheduleCustomTypeID, + }, ChannelAdminLogEventActionClassName: { ChannelAdminLogEventActionChangeTitleTypeID, ChannelAdminLogEventActionChangeAboutTypeID, @@ -5826,6 +5996,10 @@ func ClassConstructorsMap() map[string][]uint32 { HelpTermsOfServiceUpdateEmptyTypeID, HelpTermsOfServiceUpdateTypeID, }, + HelpTimezonesListClassName: { + HelpTimezonesListNotModifiedTypeID, + HelpTimezonesListTypeID, + }, HelpUserInfoClassName: { HelpUserInfoEmptyTypeID, HelpUserInfoTypeID, @@ -5999,6 +6173,10 @@ func ClassConstructorsMap() map[string][]uint32 { InputPrivacyValueDisallowChatParticipantsTypeID, InputPrivacyValueAllowCloseFriendsTypeID, }, + InputQuickReplyShortcutClassName: { + InputQuickReplyShortcutTypeID, + InputQuickReplyShortcutIDTypeID, + }, InputReplyToClassName: { InputReplyToMessageTypeID, InputReplyToStoryTypeID, @@ -6258,6 +6436,10 @@ func ClassConstructorsMap() map[string][]uint32 { MessagesChannelMessagesTypeID, MessagesMessagesNotModifiedTypeID, }, + MessagesQuickRepliesClassName: { + MessagesQuickRepliesTypeID, + MessagesQuickRepliesNotModifiedTypeID, + }, MessagesReactionsClassName: { MessagesReactionsNotModifiedTypeID, MessagesReactionsTypeID, @@ -6736,6 +6918,12 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateSavedDialogPinnedTypeID, UpdatePinnedSavedDialogsTypeID, UpdateSavedReactionTagsTypeID, + UpdateSMSJobTypeID, + UpdateQuickRepliesTypeID, + UpdateNewQuickReplyTypeID, + UpdateDeleteQuickReplyTypeID, + UpdateQuickReplyMessageTypeID, + UpdateDeleteQuickReplyMessagesTypeID, }, UpdatesChannelDifferenceClassName: { UpdatesChannelDifferenceEmptyTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index d78f82386c..f9e7aef0af 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -2191,6 +2191,124 @@ func (s *ServerDispatcher) OnAccountGetChannelRestrictedStatusEmojis(f func(ctx s.handlers[AccountGetChannelRestrictedStatusEmojisRequestTypeID] = handler } +func (s *ServerDispatcher) OnAccountUpdateBusinessWorkHours(f func(ctx context.Context, request *AccountUpdateBusinessWorkHoursRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountUpdateBusinessWorkHoursRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[AccountUpdateBusinessWorkHoursRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountUpdateBusinessLocation(f func(ctx context.Context, request *AccountUpdateBusinessLocationRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountUpdateBusinessLocationRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[AccountUpdateBusinessLocationRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountUpdateBusinessGreetingMessage(f func(ctx context.Context, request *AccountUpdateBusinessGreetingMessageRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountUpdateBusinessGreetingMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[AccountUpdateBusinessGreetingMessageRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountUpdateBusinessAwayMessage(f func(ctx context.Context, request *AccountUpdateBusinessAwayMessageRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountUpdateBusinessAwayMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[AccountUpdateBusinessAwayMessageRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountUpdateConnectedBot(f func(ctx context.Context, request *AccountUpdateConnectedBotRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountUpdateConnectedBotRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[AccountUpdateConnectedBotRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountGetConnectedBots(f func(ctx context.Context) (*AccountConnectedBots, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountGetConnectedBotsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[AccountGetConnectedBotsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUsersGetUsers(f func(ctx context.Context, id []InputUserClass) ([]UserClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UsersGetUsersRequest @@ -4808,7 +4926,7 @@ func (s *ServerDispatcher) OnMessagesToggleStickerSets(f func(ctx context.Contex s.handlers[MessagesToggleStickerSetsRequestTypeID] = handler } -func (s *ServerDispatcher) OnMessagesGetDialogFilters(f func(ctx context.Context) ([]DialogFilterClass, error)) { +func (s *ServerDispatcher) OnMessagesGetDialogFilters(f func(ctx context.Context) (*MessagesDialogFilters, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request MessagesGetDialogFiltersRequest if err := request.Decode(b); err != nil { @@ -4819,7 +4937,7 @@ func (s *ServerDispatcher) OnMessagesGetDialogFilters(f func(ctx context.Context if err != nil { return nil, err } - return &DialogFilterClassVector{Elems: response}, nil + return response, nil } s.handlers[MessagesGetDialogFiltersRequestTypeID] = handler @@ -6278,6 +6396,179 @@ func (s *ServerDispatcher) OnMessagesGetOutboxReadDate(f func(ctx context.Contex s.handlers[MessagesGetOutboxReadDateRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesGetQuickReplies(f func(ctx context.Context, hash int64) (MessagesQuickRepliesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetQuickRepliesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Hash) + if err != nil { + return nil, err + } + return &MessagesQuickRepliesBox{QuickReplies: response}, nil + } + + s.handlers[MessagesGetQuickRepliesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesReorderQuickReplies(f func(ctx context.Context, order []int) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesReorderQuickRepliesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Order) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesReorderQuickRepliesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesCheckQuickReplyShortcut(f func(ctx context.Context, shortcut string) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesCheckQuickReplyShortcutRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Shortcut) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesCheckQuickReplyShortcutRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesEditQuickReplyShortcut(f func(ctx context.Context, request *MessagesEditQuickReplyShortcutRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesEditQuickReplyShortcutRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesEditQuickReplyShortcutRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesDeleteQuickReplyShortcut(f func(ctx context.Context, shortcutid int) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesDeleteQuickReplyShortcutRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.ShortcutID) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesDeleteQuickReplyShortcutRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesGetQuickReplyMessages(f func(ctx context.Context, request *MessagesGetQuickReplyMessagesRequest) (MessagesMessagesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetQuickReplyMessagesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &MessagesMessagesBox{Messages: response}, nil + } + + s.handlers[MessagesGetQuickReplyMessagesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesSendQuickReplyMessages(f func(ctx context.Context, request *MessagesSendQuickReplyMessagesRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesSendQuickReplyMessagesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[MessagesSendQuickReplyMessagesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesDeleteQuickReplyMessages(f func(ctx context.Context, request *MessagesDeleteQuickReplyMessagesRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesDeleteQuickReplyMessagesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[MessagesDeleteQuickReplyMessagesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesToggleDialogFilterTags(f func(ctx context.Context, enabled bool) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesToggleDialogFilterTagsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Enabled) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesToggleDialogFilterTagsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UpdatesGetStateRequest @@ -6986,6 +7277,23 @@ func (s *ServerDispatcher) OnHelpGetPeerProfileColors(f func(ctx context.Context s.handlers[HelpGetPeerProfileColorsRequestTypeID] = handler } +func (s *ServerDispatcher) OnHelpGetTimezonesList(f func(ctx context.Context, hash int) (HelpTimezonesListClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request HelpGetTimezonesListRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Hash) + if err != nil { + return nil, err + } + return &HelpTimezonesListBox{TimezonesList: response}, nil + } + + s.handlers[HelpGetTimezonesListRequestTypeID] = handler +} + func (s *ServerDispatcher) OnChannelsReadHistory(f func(ctx context.Context, request *ChannelsReadHistoryRequest) (bool, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChannelsReadHistoryRequest @@ -10346,6 +10654,141 @@ func (s *ServerDispatcher) OnPremiumGetUserBoosts(f func(ctx context.Context, re s.handlers[PremiumGetUserBoostsRequestTypeID] = handler } +func (s *ServerDispatcher) OnSMSJobsIsEligibleToJoin(f func(ctx context.Context) (*SMSJobsEligibleToJoin, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsIsEligibleToJoinRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[SMSJobsIsEligibleToJoinRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnSMSJobsJoin(f func(ctx context.Context) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsJoinRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[SMSJobsJoinRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnSMSJobsLeave(f func(ctx context.Context) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsLeaveRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[SMSJobsLeaveRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnSMSJobsUpdateSettings(f func(ctx context.Context, request *SMSJobsUpdateSettingsRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsUpdateSettingsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[SMSJobsUpdateSettingsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnSMSJobsGetStatus(f func(ctx context.Context) (*SMSJobsStatus, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsGetStatusRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[SMSJobsGetStatusRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnSMSJobsGetSMSJob(f func(ctx context.Context, jobid string) (*SMSJob, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsGetSMSJobRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.JobID) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[SMSJobsGetSMSJobRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnSMSJobsFinishJob(f func(ctx context.Context, request *SMSJobsFinishJobRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request SMSJobsFinishJobRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[SMSJobsFinishJobRequestTypeID] = handler +} + func (s *ServerDispatcher) OnTestUseError(f func(ctx context.Context) (*Error, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request TestUseErrorRequest diff --git a/tg/tl_sms_job_gen.go b/tg/tl_sms_job_gen.go new file mode 100644 index 0000000000..a2f5bd3bbe --- /dev/null +++ b/tg/tl_sms_job_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJob represents TL type `smsJob#e6a1eeb8`. +// +// See https://core.telegram.org/constructor/smsJob for reference. +type SMSJob struct { + // JobID field of SMSJob. + JobID string + // PhoneNumber field of SMSJob. + PhoneNumber string + // Text field of SMSJob. + Text string +} + +// SMSJobTypeID is TL type id of SMSJob. +const SMSJobTypeID = 0xe6a1eeb8 + +// Ensuring interfaces in compile-time for SMSJob. +var ( + _ bin.Encoder = &SMSJob{} + _ bin.Decoder = &SMSJob{} + _ bin.BareEncoder = &SMSJob{} + _ bin.BareDecoder = &SMSJob{} +) + +func (s *SMSJob) Zero() bool { + if s == nil { + return true + } + if !(s.JobID == "") { + return false + } + if !(s.PhoneNumber == "") { + return false + } + if !(s.Text == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SMSJob) String() string { + if s == nil { + return "SMSJob(nil)" + } + type Alias SMSJob + return fmt.Sprintf("SMSJob%+v", Alias(*s)) +} + +// FillFrom fills SMSJob from given interface. +func (s *SMSJob) FillFrom(from interface { + GetJobID() (value string) + GetPhoneNumber() (value string) + GetText() (value string) +}) { + s.JobID = from.GetJobID() + s.PhoneNumber = from.GetPhoneNumber() + s.Text = from.GetText() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJob) TypeID() uint32 { + return SMSJobTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJob) TypeName() string { + return "smsJob" +} + +// TypeInfo returns info about TL type. +func (s *SMSJob) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsJob", + ID: SMSJobTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "JobID", + SchemaName: "job_id", + }, + { + Name: "PhoneNumber", + SchemaName: "phone_number", + }, + { + Name: "Text", + SchemaName: "text", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SMSJob) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode smsJob#e6a1eeb8 as nil") + } + b.PutID(SMSJobTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SMSJob) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode smsJob#e6a1eeb8 as nil") + } + b.PutString(s.JobID) + b.PutString(s.PhoneNumber) + b.PutString(s.Text) + return nil +} + +// Decode implements bin.Decoder. +func (s *SMSJob) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode smsJob#e6a1eeb8 to nil") + } + if err := b.ConsumeID(SMSJobTypeID); err != nil { + return fmt.Errorf("unable to decode smsJob#e6a1eeb8: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SMSJob) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode smsJob#e6a1eeb8 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsJob#e6a1eeb8: field job_id: %w", err) + } + s.JobID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsJob#e6a1eeb8: field phone_number: %w", err) + } + s.PhoneNumber = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsJob#e6a1eeb8: field text: %w", err) + } + s.Text = value + } + return nil +} + +// GetJobID returns value of JobID field. +func (s *SMSJob) GetJobID() (value string) { + if s == nil { + return + } + return s.JobID +} + +// GetPhoneNumber returns value of PhoneNumber field. +func (s *SMSJob) GetPhoneNumber() (value string) { + if s == nil { + return + } + return s.PhoneNumber +} + +// GetText returns value of Text field. +func (s *SMSJob) GetText() (value string) { + if s == nil { + return + } + return s.Text +} diff --git a/tg/tl_sms_job_slices_gen.go b/tg/tl_sms_job_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_sms_job_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_eligible_to_join_gen.go b/tg/tl_smsjobs_eligible_to_join_gen.go new file mode 100644 index 0000000000..3f936b5274 --- /dev/null +++ b/tg/tl_smsjobs_eligible_to_join_gen.go @@ -0,0 +1,188 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsEligibleToJoin represents TL type `smsjobs.eligibleToJoin#dc8b44cf`. +// +// See https://core.telegram.org/constructor/smsjobs.eligibleToJoin for reference. +type SMSJobsEligibleToJoin struct { + // TermsURL field of SMSJobsEligibleToJoin. + TermsURL string + // MonthlySentSMS field of SMSJobsEligibleToJoin. + MonthlySentSMS int +} + +// SMSJobsEligibleToJoinTypeID is TL type id of SMSJobsEligibleToJoin. +const SMSJobsEligibleToJoinTypeID = 0xdc8b44cf + +// Ensuring interfaces in compile-time for SMSJobsEligibleToJoin. +var ( + _ bin.Encoder = &SMSJobsEligibleToJoin{} + _ bin.Decoder = &SMSJobsEligibleToJoin{} + _ bin.BareEncoder = &SMSJobsEligibleToJoin{} + _ bin.BareDecoder = &SMSJobsEligibleToJoin{} +) + +func (e *SMSJobsEligibleToJoin) Zero() bool { + if e == nil { + return true + } + if !(e.TermsURL == "") { + return false + } + if !(e.MonthlySentSMS == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *SMSJobsEligibleToJoin) String() string { + if e == nil { + return "SMSJobsEligibleToJoin(nil)" + } + type Alias SMSJobsEligibleToJoin + return fmt.Sprintf("SMSJobsEligibleToJoin%+v", Alias(*e)) +} + +// FillFrom fills SMSJobsEligibleToJoin from given interface. +func (e *SMSJobsEligibleToJoin) FillFrom(from interface { + GetTermsURL() (value string) + GetMonthlySentSMS() (value int) +}) { + e.TermsURL = from.GetTermsURL() + e.MonthlySentSMS = from.GetMonthlySentSMS() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsEligibleToJoin) TypeID() uint32 { + return SMSJobsEligibleToJoinTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsEligibleToJoin) TypeName() string { + return "smsjobs.eligibleToJoin" +} + +// TypeInfo returns info about TL type. +func (e *SMSJobsEligibleToJoin) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.eligibleToJoin", + ID: SMSJobsEligibleToJoinTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TermsURL", + SchemaName: "terms_url", + }, + { + Name: "MonthlySentSMS", + SchemaName: "monthly_sent_sms", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *SMSJobsEligibleToJoin) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode smsjobs.eligibleToJoin#dc8b44cf as nil") + } + b.PutID(SMSJobsEligibleToJoinTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *SMSJobsEligibleToJoin) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode smsjobs.eligibleToJoin#dc8b44cf as nil") + } + b.PutString(e.TermsURL) + b.PutInt(e.MonthlySentSMS) + return nil +} + +// Decode implements bin.Decoder. +func (e *SMSJobsEligibleToJoin) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode smsjobs.eligibleToJoin#dc8b44cf to nil") + } + if err := b.ConsumeID(SMSJobsEligibleToJoinTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *SMSJobsEligibleToJoin) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode smsjobs.eligibleToJoin#dc8b44cf to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: field terms_url: %w", err) + } + e.TermsURL = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: field monthly_sent_sms: %w", err) + } + e.MonthlySentSMS = value + } + return nil +} + +// GetTermsURL returns value of TermsURL field. +func (e *SMSJobsEligibleToJoin) GetTermsURL() (value string) { + if e == nil { + return + } + return e.TermsURL +} + +// GetMonthlySentSMS returns value of MonthlySentSMS field. +func (e *SMSJobsEligibleToJoin) GetMonthlySentSMS() (value int) { + if e == nil { + return + } + return e.MonthlySentSMS +} diff --git a/tg/tl_smsjobs_eligible_to_join_slices_gen.go b/tg/tl_smsjobs_eligible_to_join_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_eligible_to_join_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_finish_job_gen.go b/tg/tl_smsjobs_finish_job_gen.go new file mode 100644 index 0000000000..b998826974 --- /dev/null +++ b/tg/tl_smsjobs_finish_job_gen.go @@ -0,0 +1,240 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsFinishJobRequest represents TL type `smsjobs.finishJob#4f1ebf24`. +// +// See https://core.telegram.org/method/smsjobs.finishJob for reference. +type SMSJobsFinishJobRequest struct { + // Flags field of SMSJobsFinishJobRequest. + Flags bin.Fields + // JobID field of SMSJobsFinishJobRequest. + JobID string + // Error field of SMSJobsFinishJobRequest. + // + // Use SetError and GetError helpers. + Error string +} + +// SMSJobsFinishJobRequestTypeID is TL type id of SMSJobsFinishJobRequest. +const SMSJobsFinishJobRequestTypeID = 0x4f1ebf24 + +// Ensuring interfaces in compile-time for SMSJobsFinishJobRequest. +var ( + _ bin.Encoder = &SMSJobsFinishJobRequest{} + _ bin.Decoder = &SMSJobsFinishJobRequest{} + _ bin.BareEncoder = &SMSJobsFinishJobRequest{} + _ bin.BareDecoder = &SMSJobsFinishJobRequest{} +) + +func (f *SMSJobsFinishJobRequest) Zero() bool { + if f == nil { + return true + } + if !(f.Flags.Zero()) { + return false + } + if !(f.JobID == "") { + return false + } + if !(f.Error == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *SMSJobsFinishJobRequest) String() string { + if f == nil { + return "SMSJobsFinishJobRequest(nil)" + } + type Alias SMSJobsFinishJobRequest + return fmt.Sprintf("SMSJobsFinishJobRequest%+v", Alias(*f)) +} + +// FillFrom fills SMSJobsFinishJobRequest from given interface. +func (f *SMSJobsFinishJobRequest) FillFrom(from interface { + GetJobID() (value string) + GetError() (value string, ok bool) +}) { + f.JobID = from.GetJobID() + if val, ok := from.GetError(); ok { + f.Error = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsFinishJobRequest) TypeID() uint32 { + return SMSJobsFinishJobRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsFinishJobRequest) TypeName() string { + return "smsjobs.finishJob" +} + +// TypeInfo returns info about TL type. +func (f *SMSJobsFinishJobRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.finishJob", + ID: SMSJobsFinishJobRequestTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "JobID", + SchemaName: "job_id", + }, + { + Name: "Error", + SchemaName: "error", + Null: !f.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (f *SMSJobsFinishJobRequest) SetFlags() { + if !(f.Error == "") { + f.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (f *SMSJobsFinishJobRequest) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode smsjobs.finishJob#4f1ebf24 as nil") + } + b.PutID(SMSJobsFinishJobRequestTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *SMSJobsFinishJobRequest) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode smsjobs.finishJob#4f1ebf24 as nil") + } + f.SetFlags() + if err := f.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode smsjobs.finishJob#4f1ebf24: field flags: %w", err) + } + b.PutString(f.JobID) + if f.Flags.Has(0) { + b.PutString(f.Error) + } + return nil +} + +// Decode implements bin.Decoder. +func (f *SMSJobsFinishJobRequest) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode smsjobs.finishJob#4f1ebf24 to nil") + } + if err := b.ConsumeID(SMSJobsFinishJobRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.finishJob#4f1ebf24: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *SMSJobsFinishJobRequest) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode smsjobs.finishJob#4f1ebf24 to nil") + } + { + if err := f.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode smsjobs.finishJob#4f1ebf24: field flags: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.finishJob#4f1ebf24: field job_id: %w", err) + } + f.JobID = value + } + if f.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.finishJob#4f1ebf24: field error: %w", err) + } + f.Error = value + } + return nil +} + +// GetJobID returns value of JobID field. +func (f *SMSJobsFinishJobRequest) GetJobID() (value string) { + if f == nil { + return + } + return f.JobID +} + +// SetError sets value of Error conditional field. +func (f *SMSJobsFinishJobRequest) SetError(value string) { + f.Flags.Set(0) + f.Error = value +} + +// GetError returns value of Error conditional field and +// boolean which is true if field was set. +func (f *SMSJobsFinishJobRequest) GetError() (value string, ok bool) { + if f == nil { + return + } + if !f.Flags.Has(0) { + return value, false + } + return f.Error, true +} + +// SMSJobsFinishJob invokes method smsjobs.finishJob#4f1ebf24 returning error if any. +// +// See https://core.telegram.org/method/smsjobs.finishJob for reference. +func (c *Client) SMSJobsFinishJob(ctx context.Context, request *SMSJobsFinishJobRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_smsjobs_finish_job_slices_gen.go b/tg/tl_smsjobs_finish_job_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_finish_job_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_get_sms_job_gen.go b/tg/tl_smsjobs_get_sms_job_gen.go new file mode 100644 index 0000000000..ab0921cab0 --- /dev/null +++ b/tg/tl_smsjobs_get_sms_job_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsGetSMSJobRequest represents TL type `smsjobs.getSmsJob#778d902f`. +// +// See https://core.telegram.org/method/smsjobs.getSmsJob for reference. +type SMSJobsGetSMSJobRequest struct { + // JobID field of SMSJobsGetSMSJobRequest. + JobID string +} + +// SMSJobsGetSMSJobRequestTypeID is TL type id of SMSJobsGetSMSJobRequest. +const SMSJobsGetSMSJobRequestTypeID = 0x778d902f + +// Ensuring interfaces in compile-time for SMSJobsGetSMSJobRequest. +var ( + _ bin.Encoder = &SMSJobsGetSMSJobRequest{} + _ bin.Decoder = &SMSJobsGetSMSJobRequest{} + _ bin.BareEncoder = &SMSJobsGetSMSJobRequest{} + _ bin.BareDecoder = &SMSJobsGetSMSJobRequest{} +) + +func (g *SMSJobsGetSMSJobRequest) Zero() bool { + if g == nil { + return true + } + if !(g.JobID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *SMSJobsGetSMSJobRequest) String() string { + if g == nil { + return "SMSJobsGetSMSJobRequest(nil)" + } + type Alias SMSJobsGetSMSJobRequest + return fmt.Sprintf("SMSJobsGetSMSJobRequest%+v", Alias(*g)) +} + +// FillFrom fills SMSJobsGetSMSJobRequest from given interface. +func (g *SMSJobsGetSMSJobRequest) FillFrom(from interface { + GetJobID() (value string) +}) { + g.JobID = from.GetJobID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsGetSMSJobRequest) TypeID() uint32 { + return SMSJobsGetSMSJobRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsGetSMSJobRequest) TypeName() string { + return "smsjobs.getSmsJob" +} + +// TypeInfo returns info about TL type. +func (g *SMSJobsGetSMSJobRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.getSmsJob", + ID: SMSJobsGetSMSJobRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "JobID", + SchemaName: "job_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *SMSJobsGetSMSJobRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode smsjobs.getSmsJob#778d902f as nil") + } + b.PutID(SMSJobsGetSMSJobRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *SMSJobsGetSMSJobRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode smsjobs.getSmsJob#778d902f as nil") + } + b.PutString(g.JobID) + return nil +} + +// Decode implements bin.Decoder. +func (g *SMSJobsGetSMSJobRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode smsjobs.getSmsJob#778d902f to nil") + } + if err := b.ConsumeID(SMSJobsGetSMSJobRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.getSmsJob#778d902f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *SMSJobsGetSMSJobRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode smsjobs.getSmsJob#778d902f to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.getSmsJob#778d902f: field job_id: %w", err) + } + g.JobID = value + } + return nil +} + +// GetJobID returns value of JobID field. +func (g *SMSJobsGetSMSJobRequest) GetJobID() (value string) { + if g == nil { + return + } + return g.JobID +} + +// SMSJobsGetSMSJob invokes method smsjobs.getSmsJob#778d902f returning error if any. +// +// See https://core.telegram.org/method/smsjobs.getSmsJob for reference. +func (c *Client) SMSJobsGetSMSJob(ctx context.Context, jobid string) (*SMSJob, error) { + var result SMSJob + + request := &SMSJobsGetSMSJobRequest{ + JobID: jobid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_smsjobs_get_sms_job_slices_gen.go b/tg/tl_smsjobs_get_sms_job_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_get_sms_job_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_get_status_gen.go b/tg/tl_smsjobs_get_status_gen.go new file mode 100644 index 0000000000..77470c3886 --- /dev/null +++ b/tg/tl_smsjobs_get_status_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsGetStatusRequest represents TL type `smsjobs.getStatus#10a698e8`. +// +// See https://core.telegram.org/method/smsjobs.getStatus for reference. +type SMSJobsGetStatusRequest struct { +} + +// SMSJobsGetStatusRequestTypeID is TL type id of SMSJobsGetStatusRequest. +const SMSJobsGetStatusRequestTypeID = 0x10a698e8 + +// Ensuring interfaces in compile-time for SMSJobsGetStatusRequest. +var ( + _ bin.Encoder = &SMSJobsGetStatusRequest{} + _ bin.Decoder = &SMSJobsGetStatusRequest{} + _ bin.BareEncoder = &SMSJobsGetStatusRequest{} + _ bin.BareDecoder = &SMSJobsGetStatusRequest{} +) + +func (g *SMSJobsGetStatusRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *SMSJobsGetStatusRequest) String() string { + if g == nil { + return "SMSJobsGetStatusRequest(nil)" + } + type Alias SMSJobsGetStatusRequest + return fmt.Sprintf("SMSJobsGetStatusRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsGetStatusRequest) TypeID() uint32 { + return SMSJobsGetStatusRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsGetStatusRequest) TypeName() string { + return "smsjobs.getStatus" +} + +// TypeInfo returns info about TL type. +func (g *SMSJobsGetStatusRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.getStatus", + ID: SMSJobsGetStatusRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *SMSJobsGetStatusRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode smsjobs.getStatus#10a698e8 as nil") + } + b.PutID(SMSJobsGetStatusRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *SMSJobsGetStatusRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode smsjobs.getStatus#10a698e8 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *SMSJobsGetStatusRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode smsjobs.getStatus#10a698e8 to nil") + } + if err := b.ConsumeID(SMSJobsGetStatusRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.getStatus#10a698e8: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *SMSJobsGetStatusRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode smsjobs.getStatus#10a698e8 to nil") + } + return nil +} + +// SMSJobsGetStatus invokes method smsjobs.getStatus#10a698e8 returning error if any. +// +// See https://core.telegram.org/method/smsjobs.getStatus for reference. +func (c *Client) SMSJobsGetStatus(ctx context.Context) (*SMSJobsStatus, error) { + var result SMSJobsStatus + + request := &SMSJobsGetStatusRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_smsjobs_get_status_slices_gen.go b/tg/tl_smsjobs_get_status_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_get_status_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_is_eligible_to_join_gen.go b/tg/tl_smsjobs_is_eligible_to_join_gen.go new file mode 100644 index 0000000000..10f0873855 --- /dev/null +++ b/tg/tl_smsjobs_is_eligible_to_join_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsIsEligibleToJoinRequest represents TL type `smsjobs.isEligibleToJoin#edc39d0`. +// +// See https://core.telegram.org/method/smsjobs.isEligibleToJoin for reference. +type SMSJobsIsEligibleToJoinRequest struct { +} + +// SMSJobsIsEligibleToJoinRequestTypeID is TL type id of SMSJobsIsEligibleToJoinRequest. +const SMSJobsIsEligibleToJoinRequestTypeID = 0xedc39d0 + +// Ensuring interfaces in compile-time for SMSJobsIsEligibleToJoinRequest. +var ( + _ bin.Encoder = &SMSJobsIsEligibleToJoinRequest{} + _ bin.Decoder = &SMSJobsIsEligibleToJoinRequest{} + _ bin.BareEncoder = &SMSJobsIsEligibleToJoinRequest{} + _ bin.BareDecoder = &SMSJobsIsEligibleToJoinRequest{} +) + +func (i *SMSJobsIsEligibleToJoinRequest) Zero() bool { + if i == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (i *SMSJobsIsEligibleToJoinRequest) String() string { + if i == nil { + return "SMSJobsIsEligibleToJoinRequest(nil)" + } + type Alias SMSJobsIsEligibleToJoinRequest + return fmt.Sprintf("SMSJobsIsEligibleToJoinRequest%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsIsEligibleToJoinRequest) TypeID() uint32 { + return SMSJobsIsEligibleToJoinRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsIsEligibleToJoinRequest) TypeName() string { + return "smsjobs.isEligibleToJoin" +} + +// TypeInfo returns info about TL type. +func (i *SMSJobsIsEligibleToJoinRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.isEligibleToJoin", + ID: SMSJobsIsEligibleToJoinRequestTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (i *SMSJobsIsEligibleToJoinRequest) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode smsjobs.isEligibleToJoin#edc39d0 as nil") + } + b.PutID(SMSJobsIsEligibleToJoinRequestTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *SMSJobsIsEligibleToJoinRequest) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode smsjobs.isEligibleToJoin#edc39d0 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (i *SMSJobsIsEligibleToJoinRequest) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode smsjobs.isEligibleToJoin#edc39d0 to nil") + } + if err := b.ConsumeID(SMSJobsIsEligibleToJoinRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.isEligibleToJoin#edc39d0: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *SMSJobsIsEligibleToJoinRequest) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode smsjobs.isEligibleToJoin#edc39d0 to nil") + } + return nil +} + +// SMSJobsIsEligibleToJoin invokes method smsjobs.isEligibleToJoin#edc39d0 returning error if any. +// +// See https://core.telegram.org/method/smsjobs.isEligibleToJoin for reference. +func (c *Client) SMSJobsIsEligibleToJoin(ctx context.Context) (*SMSJobsEligibleToJoin, error) { + var result SMSJobsEligibleToJoin + + request := &SMSJobsIsEligibleToJoinRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_smsjobs_is_eligible_to_join_slices_gen.go b/tg/tl_smsjobs_is_eligible_to_join_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_is_eligible_to_join_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_join_gen.go b/tg/tl_smsjobs_join_gen.go new file mode 100644 index 0000000000..d4636eca3d --- /dev/null +++ b/tg/tl_smsjobs_join_gen.go @@ -0,0 +1,142 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsJoinRequest represents TL type `smsjobs.join#a74ece2d`. +// +// See https://core.telegram.org/method/smsjobs.join for reference. +type SMSJobsJoinRequest struct { +} + +// SMSJobsJoinRequestTypeID is TL type id of SMSJobsJoinRequest. +const SMSJobsJoinRequestTypeID = 0xa74ece2d + +// Ensuring interfaces in compile-time for SMSJobsJoinRequest. +var ( + _ bin.Encoder = &SMSJobsJoinRequest{} + _ bin.Decoder = &SMSJobsJoinRequest{} + _ bin.BareEncoder = &SMSJobsJoinRequest{} + _ bin.BareDecoder = &SMSJobsJoinRequest{} +) + +func (j *SMSJobsJoinRequest) Zero() bool { + if j == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (j *SMSJobsJoinRequest) String() string { + if j == nil { + return "SMSJobsJoinRequest(nil)" + } + type Alias SMSJobsJoinRequest + return fmt.Sprintf("SMSJobsJoinRequest%+v", Alias(*j)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsJoinRequest) TypeID() uint32 { + return SMSJobsJoinRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsJoinRequest) TypeName() string { + return "smsjobs.join" +} + +// TypeInfo returns info about TL type. +func (j *SMSJobsJoinRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.join", + ID: SMSJobsJoinRequestTypeID, + } + if j == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (j *SMSJobsJoinRequest) Encode(b *bin.Buffer) error { + if j == nil { + return fmt.Errorf("can't encode smsjobs.join#a74ece2d as nil") + } + b.PutID(SMSJobsJoinRequestTypeID) + return j.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (j *SMSJobsJoinRequest) EncodeBare(b *bin.Buffer) error { + if j == nil { + return fmt.Errorf("can't encode smsjobs.join#a74ece2d as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (j *SMSJobsJoinRequest) Decode(b *bin.Buffer) error { + if j == nil { + return fmt.Errorf("can't decode smsjobs.join#a74ece2d to nil") + } + if err := b.ConsumeID(SMSJobsJoinRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.join#a74ece2d: %w", err) + } + return j.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (j *SMSJobsJoinRequest) DecodeBare(b *bin.Buffer) error { + if j == nil { + return fmt.Errorf("can't decode smsjobs.join#a74ece2d to nil") + } + return nil +} + +// SMSJobsJoin invokes method smsjobs.join#a74ece2d returning error if any. +// +// See https://core.telegram.org/method/smsjobs.join for reference. +func (c *Client) SMSJobsJoin(ctx context.Context) (bool, error) { + var result BoolBox + + request := &SMSJobsJoinRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_smsjobs_join_slices_gen.go b/tg/tl_smsjobs_join_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_join_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_leave_gen.go b/tg/tl_smsjobs_leave_gen.go new file mode 100644 index 0000000000..2acec6e14d --- /dev/null +++ b/tg/tl_smsjobs_leave_gen.go @@ -0,0 +1,142 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsLeaveRequest represents TL type `smsjobs.leave#9898ad73`. +// +// See https://core.telegram.org/method/smsjobs.leave for reference. +type SMSJobsLeaveRequest struct { +} + +// SMSJobsLeaveRequestTypeID is TL type id of SMSJobsLeaveRequest. +const SMSJobsLeaveRequestTypeID = 0x9898ad73 + +// Ensuring interfaces in compile-time for SMSJobsLeaveRequest. +var ( + _ bin.Encoder = &SMSJobsLeaveRequest{} + _ bin.Decoder = &SMSJobsLeaveRequest{} + _ bin.BareEncoder = &SMSJobsLeaveRequest{} + _ bin.BareDecoder = &SMSJobsLeaveRequest{} +) + +func (l *SMSJobsLeaveRequest) Zero() bool { + if l == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (l *SMSJobsLeaveRequest) String() string { + if l == nil { + return "SMSJobsLeaveRequest(nil)" + } + type Alias SMSJobsLeaveRequest + return fmt.Sprintf("SMSJobsLeaveRequest%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsLeaveRequest) TypeID() uint32 { + return SMSJobsLeaveRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsLeaveRequest) TypeName() string { + return "smsjobs.leave" +} + +// TypeInfo returns info about TL type. +func (l *SMSJobsLeaveRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.leave", + ID: SMSJobsLeaveRequestTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (l *SMSJobsLeaveRequest) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode smsjobs.leave#9898ad73 as nil") + } + b.PutID(SMSJobsLeaveRequestTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *SMSJobsLeaveRequest) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode smsjobs.leave#9898ad73 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (l *SMSJobsLeaveRequest) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode smsjobs.leave#9898ad73 to nil") + } + if err := b.ConsumeID(SMSJobsLeaveRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.leave#9898ad73: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *SMSJobsLeaveRequest) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode smsjobs.leave#9898ad73 to nil") + } + return nil +} + +// SMSJobsLeave invokes method smsjobs.leave#9898ad73 returning error if any. +// +// See https://core.telegram.org/method/smsjobs.leave for reference. +func (c *Client) SMSJobsLeave(ctx context.Context) (bool, error) { + var result BoolBox + + request := &SMSJobsLeaveRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_smsjobs_leave_slices_gen.go b/tg/tl_smsjobs_leave_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_leave_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_status_gen.go b/tg/tl_smsjobs_status_gen.go new file mode 100644 index 0000000000..744bbd6147 --- /dev/null +++ b/tg/tl_smsjobs_status_gen.go @@ -0,0 +1,397 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsStatus represents TL type `smsjobs.status#2aee9191`. +// +// See https://core.telegram.org/constructor/smsjobs.status for reference. +type SMSJobsStatus struct { + // Flags field of SMSJobsStatus. + Flags bin.Fields + // AllowInternational field of SMSJobsStatus. + AllowInternational bool + // RecentSent field of SMSJobsStatus. + RecentSent int + // RecentSince field of SMSJobsStatus. + RecentSince int + // RecentRemains field of SMSJobsStatus. + RecentRemains int + // TotalSent field of SMSJobsStatus. + TotalSent int + // TotalSince field of SMSJobsStatus. + TotalSince int + // LastGiftSlug field of SMSJobsStatus. + // + // Use SetLastGiftSlug and GetLastGiftSlug helpers. + LastGiftSlug string + // TermsURL field of SMSJobsStatus. + TermsURL string +} + +// SMSJobsStatusTypeID is TL type id of SMSJobsStatus. +const SMSJobsStatusTypeID = 0x2aee9191 + +// Ensuring interfaces in compile-time for SMSJobsStatus. +var ( + _ bin.Encoder = &SMSJobsStatus{} + _ bin.Decoder = &SMSJobsStatus{} + _ bin.BareEncoder = &SMSJobsStatus{} + _ bin.BareDecoder = &SMSJobsStatus{} +) + +func (s *SMSJobsStatus) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.AllowInternational == false) { + return false + } + if !(s.RecentSent == 0) { + return false + } + if !(s.RecentSince == 0) { + return false + } + if !(s.RecentRemains == 0) { + return false + } + if !(s.TotalSent == 0) { + return false + } + if !(s.TotalSince == 0) { + return false + } + if !(s.LastGiftSlug == "") { + return false + } + if !(s.TermsURL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SMSJobsStatus) String() string { + if s == nil { + return "SMSJobsStatus(nil)" + } + type Alias SMSJobsStatus + return fmt.Sprintf("SMSJobsStatus%+v", Alias(*s)) +} + +// FillFrom fills SMSJobsStatus from given interface. +func (s *SMSJobsStatus) FillFrom(from interface { + GetAllowInternational() (value bool) + GetRecentSent() (value int) + GetRecentSince() (value int) + GetRecentRemains() (value int) + GetTotalSent() (value int) + GetTotalSince() (value int) + GetLastGiftSlug() (value string, ok bool) + GetTermsURL() (value string) +}) { + s.AllowInternational = from.GetAllowInternational() + s.RecentSent = from.GetRecentSent() + s.RecentSince = from.GetRecentSince() + s.RecentRemains = from.GetRecentRemains() + s.TotalSent = from.GetTotalSent() + s.TotalSince = from.GetTotalSince() + if val, ok := from.GetLastGiftSlug(); ok { + s.LastGiftSlug = val + } + + s.TermsURL = from.GetTermsURL() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsStatus) TypeID() uint32 { + return SMSJobsStatusTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsStatus) TypeName() string { + return "smsjobs.status" +} + +// TypeInfo returns info about TL type. +func (s *SMSJobsStatus) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.status", + ID: SMSJobsStatusTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "AllowInternational", + SchemaName: "allow_international", + Null: !s.Flags.Has(0), + }, + { + Name: "RecentSent", + SchemaName: "recent_sent", + }, + { + Name: "RecentSince", + SchemaName: "recent_since", + }, + { + Name: "RecentRemains", + SchemaName: "recent_remains", + }, + { + Name: "TotalSent", + SchemaName: "total_sent", + }, + { + Name: "TotalSince", + SchemaName: "total_since", + }, + { + Name: "LastGiftSlug", + SchemaName: "last_gift_slug", + Null: !s.Flags.Has(1), + }, + { + Name: "TermsURL", + SchemaName: "terms_url", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *SMSJobsStatus) SetFlags() { + if !(s.AllowInternational == false) { + s.Flags.Set(0) + } + if !(s.LastGiftSlug == "") { + s.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (s *SMSJobsStatus) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode smsjobs.status#2aee9191 as nil") + } + b.PutID(SMSJobsStatusTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SMSJobsStatus) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode smsjobs.status#2aee9191 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode smsjobs.status#2aee9191: field flags: %w", err) + } + b.PutInt(s.RecentSent) + b.PutInt(s.RecentSince) + b.PutInt(s.RecentRemains) + b.PutInt(s.TotalSent) + b.PutInt(s.TotalSince) + if s.Flags.Has(1) { + b.PutString(s.LastGiftSlug) + } + b.PutString(s.TermsURL) + return nil +} + +// Decode implements bin.Decoder. +func (s *SMSJobsStatus) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode smsjobs.status#2aee9191 to nil") + } + if err := b.ConsumeID(SMSJobsStatusTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SMSJobsStatus) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode smsjobs.status#2aee9191 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field flags: %w", err) + } + } + s.AllowInternational = s.Flags.Has(0) + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field recent_sent: %w", err) + } + s.RecentSent = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field recent_since: %w", err) + } + s.RecentSince = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field recent_remains: %w", err) + } + s.RecentRemains = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field total_sent: %w", err) + } + s.TotalSent = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field total_since: %w", err) + } + s.TotalSince = value + } + if s.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field last_gift_slug: %w", err) + } + s.LastGiftSlug = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode smsjobs.status#2aee9191: field terms_url: %w", err) + } + s.TermsURL = value + } + return nil +} + +// SetAllowInternational sets value of AllowInternational conditional field. +func (s *SMSJobsStatus) SetAllowInternational(value bool) { + if value { + s.Flags.Set(0) + s.AllowInternational = true + } else { + s.Flags.Unset(0) + s.AllowInternational = false + } +} + +// GetAllowInternational returns value of AllowInternational conditional field. +func (s *SMSJobsStatus) GetAllowInternational() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// GetRecentSent returns value of RecentSent field. +func (s *SMSJobsStatus) GetRecentSent() (value int) { + if s == nil { + return + } + return s.RecentSent +} + +// GetRecentSince returns value of RecentSince field. +func (s *SMSJobsStatus) GetRecentSince() (value int) { + if s == nil { + return + } + return s.RecentSince +} + +// GetRecentRemains returns value of RecentRemains field. +func (s *SMSJobsStatus) GetRecentRemains() (value int) { + if s == nil { + return + } + return s.RecentRemains +} + +// GetTotalSent returns value of TotalSent field. +func (s *SMSJobsStatus) GetTotalSent() (value int) { + if s == nil { + return + } + return s.TotalSent +} + +// GetTotalSince returns value of TotalSince field. +func (s *SMSJobsStatus) GetTotalSince() (value int) { + if s == nil { + return + } + return s.TotalSince +} + +// SetLastGiftSlug sets value of LastGiftSlug conditional field. +func (s *SMSJobsStatus) SetLastGiftSlug(value string) { + s.Flags.Set(1) + s.LastGiftSlug = value +} + +// GetLastGiftSlug returns value of LastGiftSlug conditional field and +// boolean which is true if field was set. +func (s *SMSJobsStatus) GetLastGiftSlug() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.LastGiftSlug, true +} + +// GetTermsURL returns value of TermsURL field. +func (s *SMSJobsStatus) GetTermsURL() (value string) { + if s == nil { + return + } + return s.TermsURL +} diff --git a/tg/tl_smsjobs_status_slices_gen.go b/tg/tl_smsjobs_status_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_status_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_smsjobs_update_settings_gen.go b/tg/tl_smsjobs_update_settings_gen.go new file mode 100644 index 0000000000..f98725226e --- /dev/null +++ b/tg/tl_smsjobs_update_settings_gen.go @@ -0,0 +1,200 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// SMSJobsUpdateSettingsRequest represents TL type `smsjobs.updateSettings#93fa0bf`. +// +// See https://core.telegram.org/method/smsjobs.updateSettings for reference. +type SMSJobsUpdateSettingsRequest struct { + // Flags field of SMSJobsUpdateSettingsRequest. + Flags bin.Fields + // AllowInternational field of SMSJobsUpdateSettingsRequest. + AllowInternational bool +} + +// SMSJobsUpdateSettingsRequestTypeID is TL type id of SMSJobsUpdateSettingsRequest. +const SMSJobsUpdateSettingsRequestTypeID = 0x93fa0bf + +// Ensuring interfaces in compile-time for SMSJobsUpdateSettingsRequest. +var ( + _ bin.Encoder = &SMSJobsUpdateSettingsRequest{} + _ bin.Decoder = &SMSJobsUpdateSettingsRequest{} + _ bin.BareEncoder = &SMSJobsUpdateSettingsRequest{} + _ bin.BareDecoder = &SMSJobsUpdateSettingsRequest{} +) + +func (u *SMSJobsUpdateSettingsRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.AllowInternational == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *SMSJobsUpdateSettingsRequest) String() string { + if u == nil { + return "SMSJobsUpdateSettingsRequest(nil)" + } + type Alias SMSJobsUpdateSettingsRequest + return fmt.Sprintf("SMSJobsUpdateSettingsRequest%+v", Alias(*u)) +} + +// FillFrom fills SMSJobsUpdateSettingsRequest from given interface. +func (u *SMSJobsUpdateSettingsRequest) FillFrom(from interface { + GetAllowInternational() (value bool) +}) { + u.AllowInternational = from.GetAllowInternational() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SMSJobsUpdateSettingsRequest) TypeID() uint32 { + return SMSJobsUpdateSettingsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SMSJobsUpdateSettingsRequest) TypeName() string { + return "smsjobs.updateSettings" +} + +// TypeInfo returns info about TL type. +func (u *SMSJobsUpdateSettingsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "smsjobs.updateSettings", + ID: SMSJobsUpdateSettingsRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "AllowInternational", + SchemaName: "allow_international", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *SMSJobsUpdateSettingsRequest) SetFlags() { + if !(u.AllowInternational == false) { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *SMSJobsUpdateSettingsRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode smsjobs.updateSettings#93fa0bf as nil") + } + b.PutID(SMSJobsUpdateSettingsRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *SMSJobsUpdateSettingsRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode smsjobs.updateSettings#93fa0bf as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode smsjobs.updateSettings#93fa0bf: field flags: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *SMSJobsUpdateSettingsRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode smsjobs.updateSettings#93fa0bf to nil") + } + if err := b.ConsumeID(SMSJobsUpdateSettingsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode smsjobs.updateSettings#93fa0bf: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *SMSJobsUpdateSettingsRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode smsjobs.updateSettings#93fa0bf to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode smsjobs.updateSettings#93fa0bf: field flags: %w", err) + } + } + u.AllowInternational = u.Flags.Has(0) + return nil +} + +// SetAllowInternational sets value of AllowInternational conditional field. +func (u *SMSJobsUpdateSettingsRequest) SetAllowInternational(value bool) { + if value { + u.Flags.Set(0) + u.AllowInternational = true + } else { + u.Flags.Unset(0) + u.AllowInternational = false + } +} + +// GetAllowInternational returns value of AllowInternational conditional field. +func (u *SMSJobsUpdateSettingsRequest) GetAllowInternational() (value bool) { + if u == nil { + return + } + return u.Flags.Has(0) +} + +// SMSJobsUpdateSettings invokes method smsjobs.updateSettings#93fa0bf returning error if any. +// +// See https://core.telegram.org/method/smsjobs.updateSettings for reference. +func (c *Client) SMSJobsUpdateSettings(ctx context.Context, request *SMSJobsUpdateSettingsRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_smsjobs_update_settings_slices_gen.go b/tg/tl_smsjobs_update_settings_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_smsjobs_update_settings_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_timezone_gen.go b/tg/tl_timezone_gen.go new file mode 100644 index 0000000000..1a245403a0 --- /dev/null +++ b/tg/tl_timezone_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// Timezone represents TL type `timezone#ff9289f5`. +// +// See https://core.telegram.org/constructor/timezone for reference. +type Timezone struct { + // ID field of Timezone. + ID string + // Name field of Timezone. + Name string + // UtcOffset field of Timezone. + UtcOffset int +} + +// TimezoneTypeID is TL type id of Timezone. +const TimezoneTypeID = 0xff9289f5 + +// Ensuring interfaces in compile-time for Timezone. +var ( + _ bin.Encoder = &Timezone{} + _ bin.Decoder = &Timezone{} + _ bin.BareEncoder = &Timezone{} + _ bin.BareDecoder = &Timezone{} +) + +func (t *Timezone) Zero() bool { + if t == nil { + return true + } + if !(t.ID == "") { + return false + } + if !(t.Name == "") { + return false + } + if !(t.UtcOffset == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *Timezone) String() string { + if t == nil { + return "Timezone(nil)" + } + type Alias Timezone + return fmt.Sprintf("Timezone%+v", Alias(*t)) +} + +// FillFrom fills Timezone from given interface. +func (t *Timezone) FillFrom(from interface { + GetID() (value string) + GetName() (value string) + GetUtcOffset() (value int) +}) { + t.ID = from.GetID() + t.Name = from.GetName() + t.UtcOffset = from.GetUtcOffset() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*Timezone) TypeID() uint32 { + return TimezoneTypeID +} + +// TypeName returns name of type in TL schema. +func (*Timezone) TypeName() string { + return "timezone" +} + +// TypeInfo returns info about TL type. +func (t *Timezone) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "timezone", + ID: TimezoneTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "UtcOffset", + SchemaName: "utc_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *Timezone) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode timezone#ff9289f5 as nil") + } + b.PutID(TimezoneTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *Timezone) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode timezone#ff9289f5 as nil") + } + b.PutString(t.ID) + b.PutString(t.Name) + b.PutInt(t.UtcOffset) + return nil +} + +// Decode implements bin.Decoder. +func (t *Timezone) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode timezone#ff9289f5 to nil") + } + if err := b.ConsumeID(TimezoneTypeID); err != nil { + return fmt.Errorf("unable to decode timezone#ff9289f5: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *Timezone) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode timezone#ff9289f5 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode timezone#ff9289f5: field id: %w", err) + } + t.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode timezone#ff9289f5: field name: %w", err) + } + t.Name = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode timezone#ff9289f5: field utc_offset: %w", err) + } + t.UtcOffset = value + } + return nil +} + +// GetID returns value of ID field. +func (t *Timezone) GetID() (value string) { + if t == nil { + return + } + return t.ID +} + +// GetName returns value of Name field. +func (t *Timezone) GetName() (value string) { + if t == nil { + return + } + return t.Name +} + +// GetUtcOffset returns value of UtcOffset field. +func (t *Timezone) GetUtcOffset() (value int) { + if t == nil { + return + } + return t.UtcOffset +} diff --git a/tg/tl_timezone_slices_gen.go b/tg/tl_timezone_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_timezone_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_update_gen.go b/tg/tl_update_gen.go index 19b3a0241e..e649311ec7 100644 --- a/tg/tl_update_gen.go +++ b/tg/tl_update_gen.go @@ -25296,6 +25296,870 @@ func (u *UpdateSavedReactionTags) DecodeBare(b *bin.Buffer) error { return nil } +// UpdateSMSJob represents TL type `updateSmsJob#f16269d4`. +// +// See https://core.telegram.org/constructor/updateSmsJob for reference. +type UpdateSMSJob struct { + // JobID field of UpdateSMSJob. + JobID string +} + +// UpdateSMSJobTypeID is TL type id of UpdateSMSJob. +const UpdateSMSJobTypeID = 0xf16269d4 + +// construct implements constructor of UpdateClass. +func (u UpdateSMSJob) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateSMSJob. +var ( + _ bin.Encoder = &UpdateSMSJob{} + _ bin.Decoder = &UpdateSMSJob{} + _ bin.BareEncoder = &UpdateSMSJob{} + _ bin.BareDecoder = &UpdateSMSJob{} + + _ UpdateClass = &UpdateSMSJob{} +) + +func (u *UpdateSMSJob) Zero() bool { + if u == nil { + return true + } + if !(u.JobID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateSMSJob) String() string { + if u == nil { + return "UpdateSMSJob(nil)" + } + type Alias UpdateSMSJob + return fmt.Sprintf("UpdateSMSJob%+v", Alias(*u)) +} + +// FillFrom fills UpdateSMSJob from given interface. +func (u *UpdateSMSJob) FillFrom(from interface { + GetJobID() (value string) +}) { + u.JobID = from.GetJobID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateSMSJob) TypeID() uint32 { + return UpdateSMSJobTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateSMSJob) TypeName() string { + return "updateSmsJob" +} + +// TypeInfo returns info about TL type. +func (u *UpdateSMSJob) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateSmsJob", + ID: UpdateSMSJobTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "JobID", + SchemaName: "job_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateSMSJob) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSmsJob#f16269d4 as nil") + } + b.PutID(UpdateSMSJobTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateSMSJob) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateSmsJob#f16269d4 as nil") + } + b.PutString(u.JobID) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateSMSJob) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSmsJob#f16269d4 to nil") + } + if err := b.ConsumeID(UpdateSMSJobTypeID); err != nil { + return fmt.Errorf("unable to decode updateSmsJob#f16269d4: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateSMSJob) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateSmsJob#f16269d4 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateSmsJob#f16269d4: field job_id: %w", err) + } + u.JobID = value + } + return nil +} + +// GetJobID returns value of JobID field. +func (u *UpdateSMSJob) GetJobID() (value string) { + if u == nil { + return + } + return u.JobID +} + +// UpdateQuickReplies represents TL type `updateQuickReplies#f9470ab2`. +// +// See https://core.telegram.org/constructor/updateQuickReplies for reference. +type UpdateQuickReplies struct { + // QuickReplies field of UpdateQuickReplies. + QuickReplies []QuickReply +} + +// UpdateQuickRepliesTypeID is TL type id of UpdateQuickReplies. +const UpdateQuickRepliesTypeID = 0xf9470ab2 + +// construct implements constructor of UpdateClass. +func (u UpdateQuickReplies) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateQuickReplies. +var ( + _ bin.Encoder = &UpdateQuickReplies{} + _ bin.Decoder = &UpdateQuickReplies{} + _ bin.BareEncoder = &UpdateQuickReplies{} + _ bin.BareDecoder = &UpdateQuickReplies{} + + _ UpdateClass = &UpdateQuickReplies{} +) + +func (u *UpdateQuickReplies) Zero() bool { + if u == nil { + return true + } + if !(u.QuickReplies == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateQuickReplies) String() string { + if u == nil { + return "UpdateQuickReplies(nil)" + } + type Alias UpdateQuickReplies + return fmt.Sprintf("UpdateQuickReplies%+v", Alias(*u)) +} + +// FillFrom fills UpdateQuickReplies from given interface. +func (u *UpdateQuickReplies) FillFrom(from interface { + GetQuickReplies() (value []QuickReply) +}) { + u.QuickReplies = from.GetQuickReplies() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateQuickReplies) TypeID() uint32 { + return UpdateQuickRepliesTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateQuickReplies) TypeName() string { + return "updateQuickReplies" +} + +// TypeInfo returns info about TL type. +func (u *UpdateQuickReplies) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateQuickReplies", + ID: UpdateQuickRepliesTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "QuickReplies", + SchemaName: "quick_replies", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateQuickReplies) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateQuickReplies#f9470ab2 as nil") + } + b.PutID(UpdateQuickRepliesTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateQuickReplies) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateQuickReplies#f9470ab2 as nil") + } + b.PutVectorHeader(len(u.QuickReplies)) + for idx, v := range u.QuickReplies { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateQuickReplies#f9470ab2: field quick_replies element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateQuickReplies) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateQuickReplies#f9470ab2 to nil") + } + if err := b.ConsumeID(UpdateQuickRepliesTypeID); err != nil { + return fmt.Errorf("unable to decode updateQuickReplies#f9470ab2: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateQuickReplies) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateQuickReplies#f9470ab2 to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode updateQuickReplies#f9470ab2: field quick_replies: %w", err) + } + + if headerLen > 0 { + u.QuickReplies = make([]QuickReply, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value QuickReply + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateQuickReplies#f9470ab2: field quick_replies: %w", err) + } + u.QuickReplies = append(u.QuickReplies, value) + } + } + return nil +} + +// GetQuickReplies returns value of QuickReplies field. +func (u *UpdateQuickReplies) GetQuickReplies() (value []QuickReply) { + if u == nil { + return + } + return u.QuickReplies +} + +// UpdateNewQuickReply represents TL type `updateNewQuickReply#f53da717`. +// +// See https://core.telegram.org/constructor/updateNewQuickReply for reference. +type UpdateNewQuickReply struct { + // QuickReply field of UpdateNewQuickReply. + QuickReply QuickReply +} + +// UpdateNewQuickReplyTypeID is TL type id of UpdateNewQuickReply. +const UpdateNewQuickReplyTypeID = 0xf53da717 + +// construct implements constructor of UpdateClass. +func (u UpdateNewQuickReply) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateNewQuickReply. +var ( + _ bin.Encoder = &UpdateNewQuickReply{} + _ bin.Decoder = &UpdateNewQuickReply{} + _ bin.BareEncoder = &UpdateNewQuickReply{} + _ bin.BareDecoder = &UpdateNewQuickReply{} + + _ UpdateClass = &UpdateNewQuickReply{} +) + +func (u *UpdateNewQuickReply) Zero() bool { + if u == nil { + return true + } + if !(u.QuickReply.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateNewQuickReply) String() string { + if u == nil { + return "UpdateNewQuickReply(nil)" + } + type Alias UpdateNewQuickReply + return fmt.Sprintf("UpdateNewQuickReply%+v", Alias(*u)) +} + +// FillFrom fills UpdateNewQuickReply from given interface. +func (u *UpdateNewQuickReply) FillFrom(from interface { + GetQuickReply() (value QuickReply) +}) { + u.QuickReply = from.GetQuickReply() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateNewQuickReply) TypeID() uint32 { + return UpdateNewQuickReplyTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateNewQuickReply) TypeName() string { + return "updateNewQuickReply" +} + +// TypeInfo returns info about TL type. +func (u *UpdateNewQuickReply) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateNewQuickReply", + ID: UpdateNewQuickReplyTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "QuickReply", + SchemaName: "quick_reply", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateNewQuickReply) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateNewQuickReply#f53da717 as nil") + } + b.PutID(UpdateNewQuickReplyTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateNewQuickReply) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateNewQuickReply#f53da717 as nil") + } + if err := u.QuickReply.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateNewQuickReply#f53da717: field quick_reply: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateNewQuickReply) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateNewQuickReply#f53da717 to nil") + } + if err := b.ConsumeID(UpdateNewQuickReplyTypeID); err != nil { + return fmt.Errorf("unable to decode updateNewQuickReply#f53da717: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateNewQuickReply) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateNewQuickReply#f53da717 to nil") + } + { + if err := u.QuickReply.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateNewQuickReply#f53da717: field quick_reply: %w", err) + } + } + return nil +} + +// GetQuickReply returns value of QuickReply field. +func (u *UpdateNewQuickReply) GetQuickReply() (value QuickReply) { + if u == nil { + return + } + return u.QuickReply +} + +// UpdateDeleteQuickReply represents TL type `updateDeleteQuickReply#53e6f1ec`. +// +// See https://core.telegram.org/constructor/updateDeleteQuickReply for reference. +type UpdateDeleteQuickReply struct { + // ShortcutID field of UpdateDeleteQuickReply. + ShortcutID int +} + +// UpdateDeleteQuickReplyTypeID is TL type id of UpdateDeleteQuickReply. +const UpdateDeleteQuickReplyTypeID = 0x53e6f1ec + +// construct implements constructor of UpdateClass. +func (u UpdateDeleteQuickReply) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateDeleteQuickReply. +var ( + _ bin.Encoder = &UpdateDeleteQuickReply{} + _ bin.Decoder = &UpdateDeleteQuickReply{} + _ bin.BareEncoder = &UpdateDeleteQuickReply{} + _ bin.BareDecoder = &UpdateDeleteQuickReply{} + + _ UpdateClass = &UpdateDeleteQuickReply{} +) + +func (u *UpdateDeleteQuickReply) Zero() bool { + if u == nil { + return true + } + if !(u.ShortcutID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateDeleteQuickReply) String() string { + if u == nil { + return "UpdateDeleteQuickReply(nil)" + } + type Alias UpdateDeleteQuickReply + return fmt.Sprintf("UpdateDeleteQuickReply%+v", Alias(*u)) +} + +// FillFrom fills UpdateDeleteQuickReply from given interface. +func (u *UpdateDeleteQuickReply) FillFrom(from interface { + GetShortcutID() (value int) +}) { + u.ShortcutID = from.GetShortcutID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateDeleteQuickReply) TypeID() uint32 { + return UpdateDeleteQuickReplyTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateDeleteQuickReply) TypeName() string { + return "updateDeleteQuickReply" +} + +// TypeInfo returns info about TL type. +func (u *UpdateDeleteQuickReply) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateDeleteQuickReply", + ID: UpdateDeleteQuickReplyTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateDeleteQuickReply) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateDeleteQuickReply#53e6f1ec as nil") + } + b.PutID(UpdateDeleteQuickReplyTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateDeleteQuickReply) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateDeleteQuickReply#53e6f1ec as nil") + } + b.PutInt(u.ShortcutID) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateDeleteQuickReply) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateDeleteQuickReply#53e6f1ec to nil") + } + if err := b.ConsumeID(UpdateDeleteQuickReplyTypeID); err != nil { + return fmt.Errorf("unable to decode updateDeleteQuickReply#53e6f1ec: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateDeleteQuickReply) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateDeleteQuickReply#53e6f1ec to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateDeleteQuickReply#53e6f1ec: field shortcut_id: %w", err) + } + u.ShortcutID = value + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (u *UpdateDeleteQuickReply) GetShortcutID() (value int) { + if u == nil { + return + } + return u.ShortcutID +} + +// UpdateQuickReplyMessage represents TL type `updateQuickReplyMessage#3e050d0f`. +// +// See https://core.telegram.org/constructor/updateQuickReplyMessage for reference. +type UpdateQuickReplyMessage struct { + // Message field of UpdateQuickReplyMessage. + Message MessageClass +} + +// UpdateQuickReplyMessageTypeID is TL type id of UpdateQuickReplyMessage. +const UpdateQuickReplyMessageTypeID = 0x3e050d0f + +// construct implements constructor of UpdateClass. +func (u UpdateQuickReplyMessage) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateQuickReplyMessage. +var ( + _ bin.Encoder = &UpdateQuickReplyMessage{} + _ bin.Decoder = &UpdateQuickReplyMessage{} + _ bin.BareEncoder = &UpdateQuickReplyMessage{} + _ bin.BareDecoder = &UpdateQuickReplyMessage{} + + _ UpdateClass = &UpdateQuickReplyMessage{} +) + +func (u *UpdateQuickReplyMessage) Zero() bool { + if u == nil { + return true + } + if !(u.Message == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateQuickReplyMessage) String() string { + if u == nil { + return "UpdateQuickReplyMessage(nil)" + } + type Alias UpdateQuickReplyMessage + return fmt.Sprintf("UpdateQuickReplyMessage%+v", Alias(*u)) +} + +// FillFrom fills UpdateQuickReplyMessage from given interface. +func (u *UpdateQuickReplyMessage) FillFrom(from interface { + GetMessage() (value MessageClass) +}) { + u.Message = from.GetMessage() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateQuickReplyMessage) TypeID() uint32 { + return UpdateQuickReplyMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateQuickReplyMessage) TypeName() string { + return "updateQuickReplyMessage" +} + +// TypeInfo returns info about TL type. +func (u *UpdateQuickReplyMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateQuickReplyMessage", + ID: UpdateQuickReplyMessageTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateQuickReplyMessage) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateQuickReplyMessage#3e050d0f as nil") + } + b.PutID(UpdateQuickReplyMessageTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateQuickReplyMessage) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateQuickReplyMessage#3e050d0f as nil") + } + if u.Message == nil { + return fmt.Errorf("unable to encode updateQuickReplyMessage#3e050d0f: field message is nil") + } + if err := u.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateQuickReplyMessage#3e050d0f: field message: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateQuickReplyMessage) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateQuickReplyMessage#3e050d0f to nil") + } + if err := b.ConsumeID(UpdateQuickReplyMessageTypeID); err != nil { + return fmt.Errorf("unable to decode updateQuickReplyMessage#3e050d0f: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateQuickReplyMessage) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateQuickReplyMessage#3e050d0f to nil") + } + { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode updateQuickReplyMessage#3e050d0f: field message: %w", err) + } + u.Message = value + } + return nil +} + +// GetMessage returns value of Message field. +func (u *UpdateQuickReplyMessage) GetMessage() (value MessageClass) { + if u == nil { + return + } + return u.Message +} + +// UpdateDeleteQuickReplyMessages represents TL type `updateDeleteQuickReplyMessages#566fe7cd`. +// +// See https://core.telegram.org/constructor/updateDeleteQuickReplyMessages for reference. +type UpdateDeleteQuickReplyMessages struct { + // ShortcutID field of UpdateDeleteQuickReplyMessages. + ShortcutID int + // Messages field of UpdateDeleteQuickReplyMessages. + Messages []int +} + +// UpdateDeleteQuickReplyMessagesTypeID is TL type id of UpdateDeleteQuickReplyMessages. +const UpdateDeleteQuickReplyMessagesTypeID = 0x566fe7cd + +// construct implements constructor of UpdateClass. +func (u UpdateDeleteQuickReplyMessages) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateDeleteQuickReplyMessages. +var ( + _ bin.Encoder = &UpdateDeleteQuickReplyMessages{} + _ bin.Decoder = &UpdateDeleteQuickReplyMessages{} + _ bin.BareEncoder = &UpdateDeleteQuickReplyMessages{} + _ bin.BareDecoder = &UpdateDeleteQuickReplyMessages{} + + _ UpdateClass = &UpdateDeleteQuickReplyMessages{} +) + +func (u *UpdateDeleteQuickReplyMessages) Zero() bool { + if u == nil { + return true + } + if !(u.ShortcutID == 0) { + return false + } + if !(u.Messages == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateDeleteQuickReplyMessages) String() string { + if u == nil { + return "UpdateDeleteQuickReplyMessages(nil)" + } + type Alias UpdateDeleteQuickReplyMessages + return fmt.Sprintf("UpdateDeleteQuickReplyMessages%+v", Alias(*u)) +} + +// FillFrom fills UpdateDeleteQuickReplyMessages from given interface. +func (u *UpdateDeleteQuickReplyMessages) FillFrom(from interface { + GetShortcutID() (value int) + GetMessages() (value []int) +}) { + u.ShortcutID = from.GetShortcutID() + u.Messages = from.GetMessages() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateDeleteQuickReplyMessages) TypeID() uint32 { + return UpdateDeleteQuickReplyMessagesTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateDeleteQuickReplyMessages) TypeName() string { + return "updateDeleteQuickReplyMessages" +} + +// TypeInfo returns info about TL type. +func (u *UpdateDeleteQuickReplyMessages) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateDeleteQuickReplyMessages", + ID: UpdateDeleteQuickReplyMessagesTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ShortcutID", + SchemaName: "shortcut_id", + }, + { + Name: "Messages", + SchemaName: "messages", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateDeleteQuickReplyMessages) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateDeleteQuickReplyMessages#566fe7cd as nil") + } + b.PutID(UpdateDeleteQuickReplyMessagesTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateDeleteQuickReplyMessages) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateDeleteQuickReplyMessages#566fe7cd as nil") + } + b.PutInt(u.ShortcutID) + b.PutVectorHeader(len(u.Messages)) + for _, v := range u.Messages { + b.PutInt(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateDeleteQuickReplyMessages) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateDeleteQuickReplyMessages#566fe7cd to nil") + } + if err := b.ConsumeID(UpdateDeleteQuickReplyMessagesTypeID); err != nil { + return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateDeleteQuickReplyMessages) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateDeleteQuickReplyMessages#566fe7cd to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: field shortcut_id: %w", err) + } + u.ShortcutID = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: field messages: %w", err) + } + + if headerLen > 0 { + u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: field messages: %w", err) + } + u.Messages = append(u.Messages, value) + } + } + return nil +} + +// GetShortcutID returns value of ShortcutID field. +func (u *UpdateDeleteQuickReplyMessages) GetShortcutID() (value int) { + if u == nil { + return + } + return u.ShortcutID +} + +// GetMessages returns value of Messages field. +func (u *UpdateDeleteQuickReplyMessages) GetMessages() (value []int) { + if u == nil { + return + } + return u.Messages +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -25435,6 +26299,12 @@ const UpdateClassName = "Update" // case *tg.UpdateSavedDialogPinned: // updateSavedDialogPinned#aeaf9e74 // case *tg.UpdatePinnedSavedDialogs: // updatePinnedSavedDialogs#686c85a6 // case *tg.UpdateSavedReactionTags: // updateSavedReactionTags#39c67432 +// case *tg.UpdateSMSJob: // updateSmsJob#f16269d4 +// case *tg.UpdateQuickReplies: // updateQuickReplies#f9470ab2 +// case *tg.UpdateNewQuickReply: // updateNewQuickReply#f53da717 +// case *tg.UpdateDeleteQuickReply: // updateDeleteQuickReply#53e6f1ec +// case *tg.UpdateQuickReplyMessage: // updateQuickReplyMessage#3e050d0f +// case *tg.UpdateDeleteQuickReplyMessages: // updateDeleteQuickReplyMessages#566fe7cd // default: panic(v) // } type UpdateClass interface { @@ -26338,6 +27208,48 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateSMSJobTypeID: + // Decoding updateSmsJob#f16269d4. + v := UpdateSMSJob{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateQuickRepliesTypeID: + // Decoding updateQuickReplies#f9470ab2. + v := UpdateQuickReplies{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateNewQuickReplyTypeID: + // Decoding updateNewQuickReply#f53da717. + v := UpdateNewQuickReply{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateDeleteQuickReplyTypeID: + // Decoding updateDeleteQuickReply#53e6f1ec. + v := UpdateDeleteQuickReply{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateQuickReplyMessageTypeID: + // Decoding updateQuickReplyMessage#3e050d0f. + v := UpdateQuickReplyMessage{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateDeleteQuickReplyMessagesTypeID: + // Decoding updateDeleteQuickReplyMessages#566fe7cd. + v := UpdateDeleteQuickReplyMessages{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_update_slices_gen.go b/tg/tl_update_slices_gen.go index 1febd85b85..7c30d34b34 100644 --- a/tg/tl_update_slices_gen.go +++ b/tg/tl_update_slices_gen.go @@ -1533,6 +1533,84 @@ func (s UpdateClassArray) AsUpdatePinnedSavedDialogs() (to UpdatePinnedSavedDial return to } +// AsUpdateSMSJob returns copy with only UpdateSMSJob constructors. +func (s UpdateClassArray) AsUpdateSMSJob() (to UpdateSMSJobArray) { + for _, elem := range s { + value, ok := elem.(*UpdateSMSJob) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateQuickReplies returns copy with only UpdateQuickReplies constructors. +func (s UpdateClassArray) AsUpdateQuickReplies() (to UpdateQuickRepliesArray) { + for _, elem := range s { + value, ok := elem.(*UpdateQuickReplies) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateNewQuickReply returns copy with only UpdateNewQuickReply constructors. +func (s UpdateClassArray) AsUpdateNewQuickReply() (to UpdateNewQuickReplyArray) { + for _, elem := range s { + value, ok := elem.(*UpdateNewQuickReply) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateDeleteQuickReply returns copy with only UpdateDeleteQuickReply constructors. +func (s UpdateClassArray) AsUpdateDeleteQuickReply() (to UpdateDeleteQuickReplyArray) { + for _, elem := range s { + value, ok := elem.(*UpdateDeleteQuickReply) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateQuickReplyMessage returns copy with only UpdateQuickReplyMessage constructors. +func (s UpdateClassArray) AsUpdateQuickReplyMessage() (to UpdateQuickReplyMessageArray) { + for _, elem := range s { + value, ok := elem.(*UpdateQuickReplyMessage) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateDeleteQuickReplyMessages returns copy with only UpdateDeleteQuickReplyMessages constructors. +func (s UpdateClassArray) AsUpdateDeleteQuickReplyMessages() (to UpdateDeleteQuickReplyMessagesArray) { + for _, elem := range s { + value, ok := elem.(*UpdateDeleteQuickReplyMessages) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // UpdateNewMessageArray is adapter for slice of UpdateNewMessage. type UpdateNewMessageArray []UpdateNewMessage @@ -10736,3 +10814,495 @@ func (s *UpdatePinnedSavedDialogsArray) Pop() (v UpdatePinnedSavedDialogs, ok bo return v, true } + +// UpdateSMSJobArray is adapter for slice of UpdateSMSJob. +type UpdateSMSJobArray []UpdateSMSJob + +// Sort sorts slice of UpdateSMSJob. +func (s UpdateSMSJobArray) Sort(less func(a, b UpdateSMSJob) bool) UpdateSMSJobArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateSMSJob. +func (s UpdateSMSJobArray) SortStable(less func(a, b UpdateSMSJob) bool) UpdateSMSJobArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateSMSJob. +func (s UpdateSMSJobArray) Retain(keep func(x UpdateSMSJob) bool) UpdateSMSJobArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateSMSJobArray) First() (v UpdateSMSJob, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateSMSJobArray) Last() (v UpdateSMSJob, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateSMSJobArray) PopFirst() (v UpdateSMSJob, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateSMSJob + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateSMSJobArray) Pop() (v UpdateSMSJob, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateQuickRepliesArray is adapter for slice of UpdateQuickReplies. +type UpdateQuickRepliesArray []UpdateQuickReplies + +// Sort sorts slice of UpdateQuickReplies. +func (s UpdateQuickRepliesArray) Sort(less func(a, b UpdateQuickReplies) bool) UpdateQuickRepliesArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateQuickReplies. +func (s UpdateQuickRepliesArray) SortStable(less func(a, b UpdateQuickReplies) bool) UpdateQuickRepliesArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateQuickReplies. +func (s UpdateQuickRepliesArray) Retain(keep func(x UpdateQuickReplies) bool) UpdateQuickRepliesArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateQuickRepliesArray) First() (v UpdateQuickReplies, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateQuickRepliesArray) Last() (v UpdateQuickReplies, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateQuickRepliesArray) PopFirst() (v UpdateQuickReplies, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateQuickReplies + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateQuickRepliesArray) Pop() (v UpdateQuickReplies, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateNewQuickReplyArray is adapter for slice of UpdateNewQuickReply. +type UpdateNewQuickReplyArray []UpdateNewQuickReply + +// Sort sorts slice of UpdateNewQuickReply. +func (s UpdateNewQuickReplyArray) Sort(less func(a, b UpdateNewQuickReply) bool) UpdateNewQuickReplyArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateNewQuickReply. +func (s UpdateNewQuickReplyArray) SortStable(less func(a, b UpdateNewQuickReply) bool) UpdateNewQuickReplyArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateNewQuickReply. +func (s UpdateNewQuickReplyArray) Retain(keep func(x UpdateNewQuickReply) bool) UpdateNewQuickReplyArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateNewQuickReplyArray) First() (v UpdateNewQuickReply, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateNewQuickReplyArray) Last() (v UpdateNewQuickReply, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateNewQuickReplyArray) PopFirst() (v UpdateNewQuickReply, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateNewQuickReply + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateNewQuickReplyArray) Pop() (v UpdateNewQuickReply, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateDeleteQuickReplyArray is adapter for slice of UpdateDeleteQuickReply. +type UpdateDeleteQuickReplyArray []UpdateDeleteQuickReply + +// Sort sorts slice of UpdateDeleteQuickReply. +func (s UpdateDeleteQuickReplyArray) Sort(less func(a, b UpdateDeleteQuickReply) bool) UpdateDeleteQuickReplyArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateDeleteQuickReply. +func (s UpdateDeleteQuickReplyArray) SortStable(less func(a, b UpdateDeleteQuickReply) bool) UpdateDeleteQuickReplyArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateDeleteQuickReply. +func (s UpdateDeleteQuickReplyArray) Retain(keep func(x UpdateDeleteQuickReply) bool) UpdateDeleteQuickReplyArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateDeleteQuickReplyArray) First() (v UpdateDeleteQuickReply, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateDeleteQuickReplyArray) Last() (v UpdateDeleteQuickReply, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateDeleteQuickReplyArray) PopFirst() (v UpdateDeleteQuickReply, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateDeleteQuickReply + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateDeleteQuickReplyArray) Pop() (v UpdateDeleteQuickReply, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateQuickReplyMessageArray is adapter for slice of UpdateQuickReplyMessage. +type UpdateQuickReplyMessageArray []UpdateQuickReplyMessage + +// Sort sorts slice of UpdateQuickReplyMessage. +func (s UpdateQuickReplyMessageArray) Sort(less func(a, b UpdateQuickReplyMessage) bool) UpdateQuickReplyMessageArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateQuickReplyMessage. +func (s UpdateQuickReplyMessageArray) SortStable(less func(a, b UpdateQuickReplyMessage) bool) UpdateQuickReplyMessageArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateQuickReplyMessage. +func (s UpdateQuickReplyMessageArray) Retain(keep func(x UpdateQuickReplyMessage) bool) UpdateQuickReplyMessageArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateQuickReplyMessageArray) First() (v UpdateQuickReplyMessage, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateQuickReplyMessageArray) Last() (v UpdateQuickReplyMessage, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateQuickReplyMessageArray) PopFirst() (v UpdateQuickReplyMessage, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateQuickReplyMessage + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateQuickReplyMessageArray) Pop() (v UpdateQuickReplyMessage, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} + +// UpdateDeleteQuickReplyMessagesArray is adapter for slice of UpdateDeleteQuickReplyMessages. +type UpdateDeleteQuickReplyMessagesArray []UpdateDeleteQuickReplyMessages + +// Sort sorts slice of UpdateDeleteQuickReplyMessages. +func (s UpdateDeleteQuickReplyMessagesArray) Sort(less func(a, b UpdateDeleteQuickReplyMessages) bool) UpdateDeleteQuickReplyMessagesArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateDeleteQuickReplyMessages. +func (s UpdateDeleteQuickReplyMessagesArray) SortStable(less func(a, b UpdateDeleteQuickReplyMessages) bool) UpdateDeleteQuickReplyMessagesArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateDeleteQuickReplyMessages. +func (s UpdateDeleteQuickReplyMessagesArray) Retain(keep func(x UpdateDeleteQuickReplyMessages) bool) UpdateDeleteQuickReplyMessagesArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateDeleteQuickReplyMessagesArray) First() (v UpdateDeleteQuickReplyMessages, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateDeleteQuickReplyMessagesArray) Last() (v UpdateDeleteQuickReplyMessages, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateDeleteQuickReplyMessagesArray) PopFirst() (v UpdateDeleteQuickReplyMessages, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateDeleteQuickReplyMessages + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateDeleteQuickReplyMessagesArray) Pop() (v UpdateDeleteQuickReplyMessages, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_user_full_gen.go b/tg/tl_user_full_gen.go index bf356eb1df..9326494205 100644 --- a/tg/tl_user_full_gen.go +++ b/tg/tl_user_full_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// UserFull represents TL type `userFull#b9b12c6c`. +// UserFull represents TL type `userFull#22ff3e85`. // Extended user info // // See https://core.telegram.org/constructor/userFull for reference. @@ -85,6 +85,8 @@ type UserFull struct { ContactRequirePremium bool // ReadDatesPrivate field of UserFull. ReadDatesPrivate bool + // Flags2 field of UserFull. + Flags2 bin.Fields // User ID ID int64 // Bio of the user @@ -177,10 +179,26 @@ type UserFull struct { // // Use SetStories and GetStories helpers. Stories PeerStories + // BusinessWorkHours field of UserFull. + // + // Use SetBusinessWorkHours and GetBusinessWorkHours helpers. + BusinessWorkHours BusinessWorkHours + // BusinessLocation field of UserFull. + // + // Use SetBusinessLocation and GetBusinessLocation helpers. + BusinessLocation BusinessLocation + // BusinessGreetingMessage field of UserFull. + // + // Use SetBusinessGreetingMessage and GetBusinessGreetingMessage helpers. + BusinessGreetingMessage BusinessGreetingMessage + // BusinessAwayMessage field of UserFull. + // + // Use SetBusinessAwayMessage and GetBusinessAwayMessage helpers. + BusinessAwayMessage BusinessAwayMessage } // UserFullTypeID is TL type id of UserFull. -const UserFullTypeID = 0xb9b12c6c +const UserFullTypeID = 0x22ff3e85 // Ensuring interfaces in compile-time for UserFull. var ( @@ -236,6 +254,9 @@ func (u *UserFull) Zero() bool { if !(u.ReadDatesPrivate == false) { return false } + if !(u.Flags2.Zero()) { + return false + } if !(u.ID == 0) { return false } @@ -293,6 +314,18 @@ func (u *UserFull) Zero() bool { if !(u.Stories.Zero()) { return false } + if !(u.BusinessWorkHours.Zero()) { + return false + } + if !(u.BusinessLocation.Zero()) { + return false + } + if !(u.BusinessGreetingMessage.Zero()) { + return false + } + if !(u.BusinessAwayMessage.Zero()) { + return false + } return true } @@ -340,6 +373,10 @@ func (u *UserFull) FillFrom(from interface { GetPremiumGifts() (value []PremiumGiftOption, ok bool) GetWallpaper() (value WallPaperClass, ok bool) GetStories() (value PeerStories, ok bool) + GetBusinessWorkHours() (value BusinessWorkHours, ok bool) + GetBusinessLocation() (value BusinessLocation, ok bool) + GetBusinessGreetingMessage() (value BusinessGreetingMessage, ok bool) + GetBusinessAwayMessage() (value BusinessAwayMessage, ok bool) }) { u.Blocked = from.GetBlocked() u.PhoneCallsAvailable = from.GetPhoneCallsAvailable() @@ -418,6 +455,22 @@ func (u *UserFull) FillFrom(from interface { u.Stories = val } + if val, ok := from.GetBusinessWorkHours(); ok { + u.BusinessWorkHours = val + } + + if val, ok := from.GetBusinessLocation(); ok { + u.BusinessLocation = val + } + + if val, ok := from.GetBusinessGreetingMessage(); ok { + u.BusinessGreetingMessage = val + } + + if val, ok := from.GetBusinessAwayMessage(); ok { + u.BusinessAwayMessage = val + } + } // TypeID returns type id in TL schema. @@ -599,6 +652,26 @@ func (u *UserFull) TypeInfo() tdp.Type { SchemaName: "stories", Null: !u.Flags.Has(25), }, + { + Name: "BusinessWorkHours", + SchemaName: "business_work_hours", + Null: !u.Flags2.Has(0), + }, + { + Name: "BusinessLocation", + SchemaName: "business_location", + Null: !u.Flags2.Has(1), + }, + { + Name: "BusinessGreetingMessage", + SchemaName: "business_greeting_message", + Null: !u.Flags2.Has(2), + }, + { + Name: "BusinessAwayMessage", + SchemaName: "business_away_message", + Null: !u.Flags2.Has(3), + }, } return typ } @@ -689,12 +762,24 @@ func (u *UserFull) SetFlags() { if !(u.Stories.Zero()) { u.Flags.Set(25) } + if !(u.BusinessWorkHours.Zero()) { + u.Flags2.Set(0) + } + if !(u.BusinessLocation.Zero()) { + u.Flags2.Set(1) + } + if !(u.BusinessGreetingMessage.Zero()) { + u.Flags2.Set(2) + } + if !(u.BusinessAwayMessage.Zero()) { + u.Flags2.Set(3) + } } // Encode implements bin.Encoder. func (u *UserFull) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userFull#b9b12c6c as nil") + return fmt.Errorf("can't encode userFull#22ff3e85 as nil") } b.PutID(UserFullTypeID) return u.EncodeBare(b) @@ -703,49 +788,52 @@ func (u *UserFull) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UserFull) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userFull#b9b12c6c as nil") + return fmt.Errorf("can't encode userFull#22ff3e85 as nil") } u.SetFlags() if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field flags: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field flags: %w", err) + } + if err := u.Flags2.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFull#22ff3e85: field flags2: %w", err) } b.PutLong(u.ID) if u.Flags.Has(1) { b.PutString(u.About) } if err := u.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field settings: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field settings: %w", err) } if u.Flags.Has(21) { if u.PersonalPhoto == nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field personal_photo is nil") + return fmt.Errorf("unable to encode userFull#22ff3e85: field personal_photo is nil") } if err := u.PersonalPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field personal_photo: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field personal_photo: %w", err) } } if u.Flags.Has(2) { if u.ProfilePhoto == nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field profile_photo is nil") + return fmt.Errorf("unable to encode userFull#22ff3e85: field profile_photo is nil") } if err := u.ProfilePhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field profile_photo: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field profile_photo: %w", err) } } if u.Flags.Has(22) { if u.FallbackPhoto == nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field fallback_photo is nil") + return fmt.Errorf("unable to encode userFull#22ff3e85: field fallback_photo is nil") } if err := u.FallbackPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field fallback_photo: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field fallback_photo: %w", err) } } if err := u.NotifySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field notify_settings: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field notify_settings: %w", err) } if u.Flags.Has(3) { if err := u.BotInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field bot_info: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field bot_info: %w", err) } } if u.Flags.Has(6) { @@ -766,33 +854,53 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error { } if u.Flags.Has(17) { if err := u.BotGroupAdminRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field bot_group_admin_rights: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field bot_group_admin_rights: %w", err) } } if u.Flags.Has(18) { if err := u.BotBroadcastAdminRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field bot_broadcast_admin_rights: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field bot_broadcast_admin_rights: %w", err) } } if u.Flags.Has(19) { b.PutVectorHeader(len(u.PremiumGifts)) for idx, v := range u.PremiumGifts { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field premium_gifts element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field premium_gifts element with index %d: %w", idx, err) } } } if u.Flags.Has(24) { if u.Wallpaper == nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field wallpaper is nil") + return fmt.Errorf("unable to encode userFull#22ff3e85: field wallpaper is nil") } if err := u.Wallpaper.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field wallpaper: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field wallpaper: %w", err) } } if u.Flags.Has(25) { if err := u.Stories.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFull#b9b12c6c: field stories: %w", err) + return fmt.Errorf("unable to encode userFull#22ff3e85: field stories: %w", err) + } + } + if u.Flags2.Has(0) { + if err := u.BusinessWorkHours.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFull#22ff3e85: field business_work_hours: %w", err) + } + } + if u.Flags2.Has(1) { + if err := u.BusinessLocation.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFull#22ff3e85: field business_location: %w", err) + } + } + if u.Flags2.Has(2) { + if err := u.BusinessGreetingMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFull#22ff3e85: field business_greeting_message: %w", err) + } + } + if u.Flags2.Has(3) { + if err := u.BusinessAwayMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode userFull#22ff3e85: field business_away_message: %w", err) } } return nil @@ -801,10 +909,10 @@ func (u *UserFull) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UserFull) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userFull#b9b12c6c to nil") + return fmt.Errorf("can't decode userFull#22ff3e85 to nil") } if err := b.ConsumeID(UserFullTypeID); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: %w", err) } return u.DecodeBare(b) } @@ -812,11 +920,11 @@ func (u *UserFull) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UserFull) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userFull#b9b12c6c to nil") + return fmt.Errorf("can't decode userFull#22ff3e85 to nil") } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field flags: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field flags: %w", err) } } u.Blocked = u.Flags.Has(0) @@ -832,112 +940,117 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { u.WallpaperOverridden = u.Flags.Has(28) u.ContactRequirePremium = u.Flags.Has(29) u.ReadDatesPrivate = u.Flags.Has(30) + { + if err := u.Flags2.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFull#22ff3e85: field flags2: %w", err) + } + } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field id: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field id: %w", err) } u.ID = value } if u.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field about: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field about: %w", err) } u.About = value } { if err := u.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field settings: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field settings: %w", err) } } if u.Flags.Has(21) { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field personal_photo: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field personal_photo: %w", err) } u.PersonalPhoto = value } if u.Flags.Has(2) { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field profile_photo: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field profile_photo: %w", err) } u.ProfilePhoto = value } if u.Flags.Has(22) { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field fallback_photo: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field fallback_photo: %w", err) } u.FallbackPhoto = value } { if err := u.NotifySettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field notify_settings: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field notify_settings: %w", err) } } if u.Flags.Has(3) { if err := u.BotInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field bot_info: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field bot_info: %w", err) } } if u.Flags.Has(6) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field pinned_msg_id: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field pinned_msg_id: %w", err) } u.PinnedMsgID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field common_chats_count: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field common_chats_count: %w", err) } u.CommonChatsCount = value } if u.Flags.Has(11) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field folder_id: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field folder_id: %w", err) } u.FolderID = value } if u.Flags.Has(14) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field ttl_period: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field ttl_period: %w", err) } u.TTLPeriod = value } if u.Flags.Has(15) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field theme_emoticon: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field theme_emoticon: %w", err) } u.ThemeEmoticon = value } if u.Flags.Has(16) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field private_forward_name: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field private_forward_name: %w", err) } u.PrivateForwardName = value } if u.Flags.Has(17) { if err := u.BotGroupAdminRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field bot_group_admin_rights: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field bot_group_admin_rights: %w", err) } } if u.Flags.Has(18) { if err := u.BotBroadcastAdminRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field bot_broadcast_admin_rights: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field bot_broadcast_admin_rights: %w", err) } } if u.Flags.Has(19) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field premium_gifts: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field premium_gifts: %w", err) } if headerLen > 0 { @@ -946,7 +1059,7 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value PremiumGiftOption if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field premium_gifts: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field premium_gifts: %w", err) } u.PremiumGifts = append(u.PremiumGifts, value) } @@ -954,13 +1067,33 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { if u.Flags.Has(24) { value, err := DecodeWallPaper(b) if err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field wallpaper: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field wallpaper: %w", err) } u.Wallpaper = value } if u.Flags.Has(25) { if err := u.Stories.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFull#b9b12c6c: field stories: %w", err) + return fmt.Errorf("unable to decode userFull#22ff3e85: field stories: %w", err) + } + } + if u.Flags2.Has(0) { + if err := u.BusinessWorkHours.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFull#22ff3e85: field business_work_hours: %w", err) + } + } + if u.Flags2.Has(1) { + if err := u.BusinessLocation.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFull#22ff3e85: field business_location: %w", err) + } + } + if u.Flags2.Has(2) { + if err := u.BusinessGreetingMessage.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFull#22ff3e85: field business_greeting_message: %w", err) + } + } + if u.Flags2.Has(3) { + if err := u.BusinessAwayMessage.Decode(b); err != nil { + return fmt.Errorf("unable to decode userFull#22ff3e85: field business_away_message: %w", err) } } return nil @@ -1515,6 +1648,78 @@ func (u *UserFull) GetStories() (value PeerStories, ok bool) { return u.Stories, true } +// SetBusinessWorkHours sets value of BusinessWorkHours conditional field. +func (u *UserFull) SetBusinessWorkHours(value BusinessWorkHours) { + u.Flags2.Set(0) + u.BusinessWorkHours = value +} + +// GetBusinessWorkHours returns value of BusinessWorkHours conditional field and +// boolean which is true if field was set. +func (u *UserFull) GetBusinessWorkHours() (value BusinessWorkHours, ok bool) { + if u == nil { + return + } + if !u.Flags2.Has(0) { + return value, false + } + return u.BusinessWorkHours, true +} + +// SetBusinessLocation sets value of BusinessLocation conditional field. +func (u *UserFull) SetBusinessLocation(value BusinessLocation) { + u.Flags2.Set(1) + u.BusinessLocation = value +} + +// GetBusinessLocation returns value of BusinessLocation conditional field and +// boolean which is true if field was set. +func (u *UserFull) GetBusinessLocation() (value BusinessLocation, ok bool) { + if u == nil { + return + } + if !u.Flags2.Has(1) { + return value, false + } + return u.BusinessLocation, true +} + +// SetBusinessGreetingMessage sets value of BusinessGreetingMessage conditional field. +func (u *UserFull) SetBusinessGreetingMessage(value BusinessGreetingMessage) { + u.Flags2.Set(2) + u.BusinessGreetingMessage = value +} + +// GetBusinessGreetingMessage returns value of BusinessGreetingMessage conditional field and +// boolean which is true if field was set. +func (u *UserFull) GetBusinessGreetingMessage() (value BusinessGreetingMessage, ok bool) { + if u == nil { + return + } + if !u.Flags2.Has(2) { + return value, false + } + return u.BusinessGreetingMessage, true +} + +// SetBusinessAwayMessage sets value of BusinessAwayMessage conditional field. +func (u *UserFull) SetBusinessAwayMessage(value BusinessAwayMessage) { + u.Flags2.Set(3) + u.BusinessAwayMessage = value +} + +// GetBusinessAwayMessage returns value of BusinessAwayMessage conditional field and +// boolean which is true if field was set. +func (u *UserFull) GetBusinessAwayMessage() (value BusinessAwayMessage, ok bool) { + if u == nil { + return + } + if !u.Flags2.Has(3) { + return value, false + } + return u.BusinessAwayMessage, true +} + // GetPersonalPhotoAsNotEmpty returns mapped value of PersonalPhoto conditional field and // boolean which is true if field was set. func (u *UserFull) GetPersonalPhotoAsNotEmpty() (*Photo, bool) {